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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

setting value to non-declared variables do not throw compiler errors?

Discussion in 'Editor & General Support' started by crowmagnon, Jun 18, 2012.

  1. crowmagnon

    crowmagnon

    Joined:
    Mar 2, 2011
    Posts:
    36
    It seems recently I noticed that Unity is not throwing compiler errors (or even runtime errors) if I try and set a value to a variable that has not been declared. This is with a javascript file. I know that it certainly used to and notifying the user about using an invalid variable is a basic function of all compilers I've ever worked with, not to mention can be a horrible bug to hunt down. Is there some option I might have inadvertently changed to affect this behavior or could this actually be something that broke in the latest release?
     
  2. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,614
    Do you have #pragma strict turned on?

    You'll have to show us some example code that shouldn't compile.
     
  3. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Right. It's the language that's broken, but that patches it.
     
  4. crowmagnon

    crowmagnon

    Joined:
    Mar 2, 2011
    Posts:
    36
    Ah, I see. No, I didn't have that pragma statement in my file, but I have started seeing that put automatically at the beginning of new .js files I create. I wondered what that was for. I never saw that before upgrading Unity to 3.5.2.