Unity: 5.1.1f
Language: c#
When i instantiate a gameObject inside a Assets/Editor/ file, it doesn't appear in Scene until i select another scene's gameobject.
I've tried calling some methods like:
SceneView.RepaintAll();
HandleUtility.Repaint();
But non of them look to be working. This is how i spawn the object:
public class PrefabEditor: Editor {
void OnSceneGUI() {
GameObject prefabInstance = Instantiate(prefab) as GameObject;
// assign him an icon label
Texture2D tex = EditorGUIUtility.IconContent("sv_label_0").image as Texture2D;
Type editorGUIUtilityType = typeof(EditorGUIUtility);
BindingFlags bindingFlags = BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.NonPublic;
object[] args = new object[] {
prefabInstance, tex
};
editorGUIUtilityType.InvokeMember("SetIconForObject", bindingFlags, null, null, args);
EditorUtility.SetDirty(prefabInstance);
}
}