- Home /
GameObject variable not appearing in Inspector?
I have a couple lines of code:
public var moveSpeed : float = 8.0;
public var spinSpeed : float = 90.0;
public var targetObj : GameObject = null;
moveSpeed and spinSpeed appear in the inspector for the script but targetObj does not. Any ideas? I've reset the script, attached and detached it multiple times and nothing seems to update the ui for the script to represent the GameObject.
I've also tried:
public var moveSpeed : float = 8.0;
public var spinSpeed : float = 90.0;
public var targetObj : GameObject;
But that didn't work either. I'm sure I'm missing something really obvious and stupid.
Answer by im.thatoneguy · Dec 04, 2012 at 08:24 PM
It was indeed something stupid. I had a syntax error elsewhere in my script and it only updates the Inspector variable list when the script has no syntax errors. Makes perfect sense.
Lesson learned!
Your answer
![](https://koobas.hobune.stream/wayback/20220613084946im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Why is my Unity script overwriting other game objects on which it is attached to? 1 Answer
In Inspector gameobject check is not visible 0 Answers
How to deal with many buttons in the Inspector 1 Answer
Unity 2021 LTS: IPointerEnterHandler is broken 1 Answer
Exposing Variable and Enforce Component Dependencies. 1 Answer