Script bar not showing up on the inspector

Godot Version

Question

im working on a pac-man game, im currently working on the ghosts, but i have a problem

in it, he shows to make the red_movement_targets.tres’s refcount’s script as ‘movement_targets.gd’, however, when i do the exact same, the bar showing the movement_targets.gd on the inspector tab isnt showing, how do i fix this?

(screenshots will be in my reply)

in the tutorial:
Captura de tela 2024-07-26 222249

in my screen:
Captura de tela 2024-07-26 222126

make sure that your movement_targets script compiles (= no error visible) and you have something like these lines

@export var scatter_targets: Array[Node2D] = []

and

@export var at_home_targets: Array[Node2D] = []

in there.

1 Like

alright then

i reconnected the script after i changed the script compiles to those you listed but it didnt work

can you put the script in here?

does it still not show you the arrays?

heres the script:

extends Resource

@export var scatter_targets: Array[Node2D] = []
@export var at_home_targets: Array[Node2D] = []

also a while ago i noticed this error in my godot engine, maybe this is related to my problem:

modules/gdscript/gdscript.cpp:2726 - Failed to load script “res://RESOURCES/movement_targets.gd” with error “Parse error”. (User)

yeah, this basically means the script could not compile. Check out the script. Does it show any error? Is anything marked red? It could also be because of some wrong whitespaces (but it should tell you if there were any).

Also maybe make sure your script does not rely on other scripts that have an error. (does not seem like this, if the script is only these three lines you’ve showed)

If it still won’t show you, just delete the script and redo it

the script (except the “extends Resource” part) is marked as red

Did you acknowledge that Resources cannot store Node references? Have you tried to use NodePath or I believe Vector2 could work (though ugly).

These as resources seems like a bad idea honestly, they should be variables on the enemies themselves.

↓ previous thread ↓

i didnt know that resources cant store node references
also i didnt use nodeath nor vector2

i tried to play the game the tutorial im using made but it gave me an error and shows that the error was from the “@export var scatter_targets: Array[Node2D]” and “@export var at_home_targets: Array[Node2D]”, perhaps maybe its because the version of godot the person that made the tutorial was using is godot 4.1, im using 4.2

1 Like