How would you give a node that has been instanced through code a script?

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

I instanced a node through code and want to also give it a script through code how would i go about doing this?

:bust_in_silhouette: Reply From: moredear
my_node = my_node_packedscene.instance()
my_node.set_script(load("res://my_script.gd"))

maybe this would help

Would you have a C# version of that?

kl–k | 2023-01-29 19:21