Setting instance parent delays scene view update
I'm working on a pretty barebones level building tool. When the editor is active, clicking will spawn a plane, raycast to see if it hits the plane, and if it does, place an aligned object in the location. Then the raycast plane is deleted.
In order to keep the scene clean, and to limit the chances of the objects I was placing causing me to lose focus on my editor, I figured that placing them as children to the editor would be the easiest solution. Then I could check to see if a raycast hit was hitting a child of the editor, and ignore the editor's attempt to change targets if so.
As soon as I did this, they stopped updating - The game view, even when not being played, updates immediately. But the editor view won't update until after I release the mouse button.
Obviously, trying to draw to a grid when you can't see what you're drawing is difficult.
What I'm trying right now:
GameObject placed = (GameObject)Instantiate(editor.prefabBrush, gridSpace, Quaternion.identity);
placed.name = editor.prefabBrush.name + " at " + gridSpace.ToString();
//Put this inside the editor.
placed.transform.parent = editor.transform;
//TODO: Make it show up when drawing >:T
EditorUtility.SetDirty(editor);
EditorUtility.SetDirty(placed);
I'm sure I'm missing some obvious hiccup here, but it seems like a very strange unexpected behaviour.
Your answer
Follow this Question
Related Questions
How do I make a credits button? 1 Answer
Unity compilation error even when VS compiles fine 0 Answers
PlayerPrefs not debugging 1 Answer