![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Atlinx |
I’m writing unit tests for my code and it would be useful if I could create an instance of the C# script I’m testing, which inherits from Node.
![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Atlinx |
I’m writing unit tests for my code and it would be useful if I could create an instance of the C# script I’m testing, which inherits from Node.
![]() |
Reply From: | Atlinx |
Ok it looks like you cannot use the “new” keyword to create a new C# node. This just makes an empty node for some reason. As a workaround for now, I’m getting the filepath to the C# script and using ResourceLoader.Load<CSharpScript>(filepath).New()
to instantiate the script. This is basically equivalent to load(filepath).new()
in GDScript.