Search Unity

How much Unityscript is too much? The answer might surprise you!

Discussion in 'Windows' started by chilton, Sep 27, 2013.

  1. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    564
    I've clearly been watching too many TV news programs.

    It turns out that just adding the following Javascript to an object in a scene will cause it to throw that "#ifdef Unity_EDITOR..."error.

    var what : String = "hi";

    Seriously, that's all I have to add. Then stuff stops working. Pretty much any Javascript in a scene with C# will cause one or the other to fail. I can't figure out which one it fails first, though.

    -Chilton
     
  2. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    I am not even entirely sure I got rid of this error... but I had a few variables being declared under #if DEFINITIONs (not necessarily UNITY_EDITOR), all I did was add [System.NonSerializable] to those fields and I stopped getting this error (but I am getting new errors so... lol)
     
  3. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    564
    Huh. Now that's interesting.

    I wonder if it's something like ... public variables with the same name as other public variables. Or something.

    ... just tested it with gibberish variable names. Nope.

    There's gotta be a way!!...
     
  4. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    In my case they were variables such as mobile controllers, so they are not the same name as other variables, they just existed for mobile and didnt exist for desktop. Setting those to nonserializable did the trick for me. But as I said, Im not sure this is the problem ur facing
     
  5. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    564
    Unfortunately these all have to be exposed, because they're configured in the editor.

    That said, I tried this with the project I'd posted in another thread and it didn't kill the bug. I'm hoping the Unity guys have an answer for me.