Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Creating ScriptableObject inside Editorguilayout InvalidOperationException

Discussion in 'Editor & General Support' started by Manato, May 5, 2016.

  1. Manato

    Manato

    Joined:
    Jun 11, 2015
    Posts:
    28
    Hi,
    I'm working on a database with scriptableobjects and editorwindow.
    But if I click on the create button in my editorwindow I get an InvalidOperationException.

    It still works fine, but the error is annoying.

    Code (CSharp):
    1. public void DrawContent() {
    2.  EditorGUILayout.BeginHorizontal();
    3.  
    4.     DrawCreateDB(); // exception
    5.     DrawLoadDB();
    6.  
    7.  EditorGUILayout.EndHorizontal();
    8. }
    Code (CSharp):
    1. public void DrawContent(){
    2.  DrawCreateDB(); // no exception
    3.  EditorGUILayout.BeginHorizontal();
    4.        
    5.   DrawLoadDB();
    6.        
    7.  EditorGUILayout.EndHorizontal();
    8. }
    I call the 'DrawContent' function in OnGUI() in a different class.
    'DrawCreateDB' have a 'Guilayout.Button' and create the asset.

    I hope someone can enlighten me.
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Can you post the exact error you're getting ?