Godot Version
4.2.1
Question
Hi guys!
I have written a Gdscript named “Attack Skill” and I want this Object Type List Selector(?) to expose my script and I want to expose the properties like in the picture attached at the end so that I can put values into it. Is there any way to do this?
Thx!!
1 Like
GBWD
December 17, 2023, 12:26pm
2
Check out the documentation on GDScript exported properties .
@export var x: int = 20
@export var y: int = 20
You can even export arrays .
3 Likes
Thanks for the answer
I think there was a misunderstanding because I only attached one picture.
My exact query is as follows
when I set the Type to Object in the meta data menu, Array, etc, I meant the exposed properties, like the photo.
I’m used to using @export in inspect to raise variables, but I’m not sure how to do it in the object detail(?) viewer.
Gustjc
December 17, 2023, 2:19pm
4
You probably want to work with Resources.
Make your Effect class extend from Resource
extends Resource
class_name Effect
@export var damage:float
Then on your player or the node you want to use you export a variable of that type
extends CharacterBody3D
@export var skill_effect : Effect
And now you can just plug your effect.
You can create then inside the inspector just like you do with collision shapes.
Or you can right-click on the file-system window and CreateNew->Resource of type Effect and then just drag the created Resource.
2 Likes
Oh, thank you so much.
That viewer was the Resource Editor!
That got me where I wanted to go.
Have a great day, both of you!
@Gustjc @GBWD
system
Closed
January 16, 2024, 2:26pm
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.