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

Question I keep getting an error saying I need to reassign an already asigned variable?

Discussion in 'Scripting' started by Relanar_Programming31, Dec 19, 2022.

  1. Relanar_Programming31

    Relanar_Programming31

    Joined:
    Dec 19, 2022
    Posts:
    1
    The variable (Insert variable name here) of (Insert script name) has not been assigned.
    You probably need to assign the (variable name) variable of the (script name) script in the inspector.
    UnityEngine.Transform.get_position () (at <4ac9ef2b8e294691b53b47afb04569b7>:0)
    (script name).Update () (at Assets/Scripts/ScriptName.cs:22)
    Edit: I resolved the problem
     

    Attached Files:

    Last edited: Dec 19, 2022
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,364
    I don't understand your question. It isn't a question. You've taken out all the useful information in the error message with "insert variable name here" nonsense. The error message is telling you what is wrong. If Player is null because you never set it in the Inspector, line 22 would have a problem.

    Maybe English is not your first language, but your bad spelling will get you in trouble. Some of these mistakes are just your variable names so there's no problem. "Verttical" is not a valid axis.