- Home /
Custom Editor Window for Prefabs
Since Unity changed the way you edit prefabs in the inspector my custom editor window is not working. The changes I make through my custom window are not saved to the prefab. And if I make a change to the prefab through inspector window, the prefab in my editor window gets lost! How do I edit my prefabs in the new system with my custom editor window?
Answer by metinevren · Mar 07, 2019 at 09:28 AM
Here is my code:
public class WavemachineEditorWindow : EditorWindow
{
private Wavemachine wavemachine;
void OnGUI()
{
wavemachine = (Wavemachine)EditorGUILayout.ObjectField(wavemachine, typeof(Wavemachine), false, GUILayout.Width(200));
wavemachine.someValue = EditorGUILayout.IntField("Value:", wavemachine.someValue);
if (GUI.changed)
{
EditorUtility.SetDirty(wavemachine);
}
}
}
Answer by himanshugupta159 · Sep 30, 2019 at 11:58 AM
Hey Guys i have recently started writing on Creating custom Editor Window and going to cover lot of details like: how to create editor window in first place, than different Gui, loading textures, prefab from Resource folder, etc.
https://unfragilecoding.blogspot.com/2019/09/unity-editor-window.html
Your answer
Follow this Question
Related Questions
How do I select a prefab that was just instantiated from an editor window? 1 Answer
Particle System deselected automaticlly whenever i go into play mode 2 Answers
Cannot draw default inspectors in custom EditorWindow 0 Answers
Card Game like yu-gi-oh 1 Answer
Set a Prefab's variable when you instantiate it, but before it calls Awake? 2 Answers