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

Object reference not set to an instance of an object (Turret)

Discussion in 'Scripting' started by SkygodGames, Jul 23, 2014.

  1. SkygodGames

    SkygodGames

    Joined:
    Feb 23, 2014
    Posts:
    18
    Im getting this weird error stating the reference object is not set up. In the unity editor I place the player into the target and I still get this error. Here are some snippets.

    If anyone has any solutions, Ill be very grateful.
     

    Attached Files:

    • WTF.PNG
      WTF.PNG
      File size:
      246 KB
      Views:
      815
    • wtf2.PNG
      wtf2.PNG
      File size:
      50.2 KB
      Views:
      759
    • wtf3.PNG
      wtf3.PNG
      File size:
      79.2 KB
      Views:
      876
  2. DarkArts-Studios

    DarkArts-Studios

    Joined:
    May 2, 2013
    Posts:
    389
    Hi,

    unfortunately my experience is with c# rather than unityscript, however I'll take a stab at it and suggest that it might be related to your having "postion" rather than "position" in your code. on that line.
     
  3. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,773
    I'm confused as to how that script compiles in the first place. Twice on line 22 and once on line 31, ".position" is misspelled. It should be giving you a compile-time error along the lines of "positon is not a member of Transform" - it shouldn't be letting you execute that code at all.
     
    SkygodGames likes this.
  4. SkygodGames

    SkygodGames

    Joined:
    Feb 23, 2014
    Posts:
    18
    Dude, that's it. Blame it on my tiredness. I should be more careful.