All Questions

Community

N
Tetteh Nartey

Script Var

How do I find the script variables in the inspector?
  • Nathan Lovato replied

    They should appear after the compiler reads your gdscript code and finds declarations with the export keyword. For example:

    export var my_variable := 50.0
    

    You can then select the node that has that script attached to it and "My Variable" should appear at the top of the Inspector.

    Sometimes, it doesn't. When that happens, try:

    • Closing and reopening the scene.
    • Closing and reopening the editor.

    The missing variables should now appear.

  • Daniel Queiroz Porto replied

    What sometimes also works for me is to:

    • comment any line of code in your script
    • uncomment it (ctrl+k to comment/uncomment is useful)
    • save the script

    This will force the compiler to reevaluate the script, and either it will work or it will give you an error message of something that's wrong with the script. Fixing that will make the script variables appear.

    But if they don't appear after that, and the script editor is not warning you of any script errors, then it's just like Nathan said, try closing and reopening scene/editor