Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

script compilation error when coding PlayerSettings

Discussion in 'Editor & General Support' started by Donsky, Jun 20, 2014.

  1. Donsky

    Donsky

    Joined:
    Mar 27, 2014
    Posts:
    80
    I wanted to set some PlayerSettings default values from code. the script doesn't give me any errors in editor, however, when I try to build standalone, I get compile errors... can anyone help?
     
  2. Donsky

    Donsky

    Joined:
    Mar 27, 2014
    Posts:
    80
    O... I built without those lines and those values seem like changed as I wanted anyway... So I don't need that part of the script any more... However, I'm still interested, what was wrong.
     
  3. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
    You need to post more details about this. What was the script? What were the compilation errors?
     
  4. Donsky

    Donsky

    Joined:
    Mar 27, 2014
    Posts:
    80
    it was something like this(this is not the full script... I was actually changing something and didn't know, the default values were automatically changed):
    Code (JavaScript):
    1. function Start()
    2. {
    3. PlayerSettings.defaultIsFullScreen=Screen.fullScreen;
    4. }
    this gives following error(only when I try to build): error.jpg

    PS : If at any chance you need the full code, just tell and I'll post it....
     
    Last edited: Jun 20, 2014
  5. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
    That's a UnityEditor class, so my best guess is that you have to copy the script to a folder called Editor in order to have it compile.
     
  6. Donsky

    Donsky

    Joined:
    Mar 27, 2014
    Posts:
    80
    Thanks for help. I'll keep that in mind, in case I need that another time.