- Edited
im having an issue
im using a tutorial to make a game, but the gd file on the area2d node isnt showing up on its inspector, like this:
in the tutorial:
on my screen:
how do i fix this issue?
im having an issue
im using a tutorial to make a game, but the gd file on the area2d node isnt showing up on its inspector, like this:
in the tutorial:
on my screen:
how do i fix this issue?
SuperGibaLogan Attach the script to the node. The tutorial is most certainly doing that and you've likely missed it.
xyz i wrote the code exactly how the tutorial did though
SuperGibaLogan Yeah but is it attached to the node?
SuperGibaLogan in the tree, the node has to have an icon next to it showing it has a script attached.
bottom of the inspector, there should be a script attached to the last item before meta_data
.
also check the console for errors.
and for exports to appear in the inspector they have to have the @export
tag before the variable declaration:
@export var speed : float = 120
Jesusemora well then, i attached the script now by right clicking the node and clicking "Attach Script", but it didnt work
SuperGibaLogan are you using C#? if so compile the project.
Jesusemora im using the regular gdscript language
SuperGibaLogan Post the screenshot of your entire editor with the node selected. Also post the attached script code.
Dude it's telling you where the error is. You could've shown us this before.
func
and _process
need a space.
Jesusemora func and _process need a space.
dont we all?
Jesusemora The custom class properties declared in the script are not showing in the inspector because the engine was unable to compile the script due to a syntax error. The editor is telling you about the error by printing a red error message and highlighting the line(s) of code that contain the error.
SuperGibaLogan i wrote the code exactly how the tutorial did though
You did not though.
xyz SuperGibaLogan i wrote the code exactly how the tutorial did though
You did not though.
lets see
yup
Jesusemora oh
btw sorry that i didnt show it before
Jesusemora i putted a space between func
and _process
SuperGibaLogan May not be the only error you made when typing the code. Any more error messages displayed by the engine? You should fix them all. Otherwise the script cannot compile and its properties won't be displayed in the inspector.
xyz there was a couple other errors i noticed, im wondering if they are actually errors or the engine read them wrong and thought they were wrong (i wrote these lines of code exactly how the tutorial shows how)
SuperGibaLogan (i wrote these lines of code exactly how the tutorial shows how)
Again, you didn't. You made errors when re-typing the tutorial code.
You need to learn the basics of GDScript syntax so you can understand what you're actually typing. It's pointless to mindlessly copy the code without understanding it, and as you can see, it's very easy to unwittingly produce a bunch of typos. I'd suggest to do a more basic tutorial than this one. Preferably the introductory 2d tutorial in the engine docs. Go slow and focus on what is being shown. Details matter a lot when coding. One mistyped character can break your entire script.
Luckily the engine tells you about it. An error message will always be shown when there is an error in a script. Aim to understand what a particular error message means. It's your hint about what you did wrong.
In the code you posted above, you have at least one syntax error; missing colon after typed function argument next_position