how do I change the @export parameters during instance?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BOX_Milk

hi
I need to make use of the item and I have in the script of the item there are 2 variables (name, icon) … ,
but I don’t know how to do it,
please help me

if you mean change the export variables when you do item.instantiate() then you can do something like

@export var name: = 'my name'
@export var icon: = 69

func _init():
    name = 'bob'
    icon = 33

OgGhostJelly | 2023-03-02 15:39

:bust_in_silhouette: Reply From: Jayden13O

I don’t understand what you mean.
If you meant how to use export vars this is how:

@export var Name : = "Default name"

Then in the inspector of the node the script is attached to you can change the value