Topic was automatically imported from the old Question2Answer platform.
Asked By
UltiEnded
I’m relatively new to Godot engine and coding in general. I was watching a tutorial on how to make a Platformer for beginners, and when the instructor typed export before var, their variable would appear in a new section under the inspector tab called “Script Variables”. However, when I do the same, the Script Variables section does not appear. I am very confused. The video was made in October of last year.
Although it doesn’t answer your question, generally speaking it is probably better to use Metadata Inspector. It allows you to create node-specific variables directly from the UI that you can use in scripts.
Exporting variables from scripts strictly speaking only makes truly sense if the variable is just a script-specific parameter (such as specifying “speed” for a scroller).
In most cases though, variables are node-specific, that is either instance or prototype-specific data elements that belong to logical objects (such as crests, creatures, trees) that store mutable properties and can be affected by a lot of different logic in the game. Logic that again belongs to many other logical objects and processes.
Metadata is exactly suited for this and with Metadata Inspector you can easily create it.
You can download Metadata Inspector from the Godot AssetLib.
If you’re promoting your own tools, be at least so fair to point out that you’re their creator, thus potentially biased when it comes to their usefulness. Personally I don’t see any real advantage of using “metadata inspector” over export variables other than that you apparently don’t need to attach a script (which is really a non-issue for me).
I know this is a bit late… but if you are doing the same tutorial I think you are doing, from GDQuest. The solution to this is that it is a bug that can only be fixed by reloading the project. After you reload the project after the first initial setup any Exports you add afterward will show up. Weird bug. I don’t know why or how it happens. That is the only solution I know of.
this is true after reload it is fixed.thank you!
jasithpramudaya | 2021-02-14 18:44
Dude I created an account just to say thank you!
AtoMMonster | 2021-03-13 16:44
Maybe you can help me out I had this issue I closed the program and reopened it and my exported variables still don’t show up I’m doing the same tutorial
Rosieisuposie | 2021-04-14 06:26
hello, i found a solution for the same problem.
I discovered that, i don’t know why, the icon of the script for “Player” in the scene window had disappeared. I just create a new script for it, clicking on the “new script” button, and the “script variables” finally appear.
Tell me if you had the same issue, and if it is now fixed.
I had the same issue, I have already export it and it works just fine initially but suddenly, the export variable does not shop up in my Inspector tab.
Apparently, the gd script attached to it was somehow removed. What I did was basically, go to my “player” node and in the inspector tab, in the Script section, I added my script file again.
Restarting the project worked for me as well. Although my problem was that I was adding [Export] after I renamed the C# script. Turns out the script reference in the tscn file wasn’t changed automatically.