Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Trouble using savepanel and unityeditor namespace in built exe

Discussion in 'Editor & General Support' started by MordazaH, Jan 3, 2019.

  1. MordazaH

    MordazaH

    Joined:
    Oct 15, 2015
    Posts:
    45
    Hi all, if this is the wrong place to ask this please receive my apologies and move it where it fits best.

    I have read in other questions about this same issue, as far as I understood the moment I use Savepanel I need to use UnityEditor namespace, and this is all fine in the editor, but when I bring this out it just cant be built. I read in several posts related to similar issues that there are 2 solutions to this.

    One solution is to move the scripts to Editor folder/subfolder and the other is include the lines mentioning this inside a " #if UNITY_EDITOR .... #endif" block, however I tried both solutions (full of fears to be honest) and none worked for me, yes I can build the project with either of the solutions propossed but the game is messed and doesnt work when moved to the Editor folder (I think the scripts under editor folder are not used so the game messes up), not even in the editor it works.

    Doing the other way with the check for unity editor it works overal fine inside and outside the editor but the savepanel function doesnt work outside the editor which seems logical as the check for editor gives a false result so savepanel is not called, then how can I bring the savepanel to allow the user to save his things? Thanks a lot for any clue regarding this, its a true headache for a couple of days now.


    Im using version 5.6.1f1 just in case its all different later on and this can be done without checking for editor or doing anything (which I think would be cool)
     
  2. Flavelius

    Flavelius

    Joined:
    Jul 8, 2012
    Posts:
    653
    MordazaH likes this.
  3. MordazaH

    MordazaH

    Joined:
    Oct 15, 2015
    Posts:
    45
    Thanks a lot Flavelius, I had no idea I couldnt use the file browser outside the editor, always though that working in the editor and out of it was the same, of course thats because I never used something from that namespace before. I will have a look and probably use the file browser you mentioned as it seems to be quite handy and free (Im on a low budget until game is sold). Well as said thanks a lot for this, you saved me here, information about this was so limited and my understanding of the editor funcions was not correct. I hope you have a great 2019, all the best for you and your people =)
     
    Flavelius likes this.