I'm trying to use reflection to serialize an object and need to figure out what script it is using so I can create an instance of it later when I deserialize it. Unfortunately get_script() and get_class() are both returning null. How do I figure out what script my object is based on?
How do I get the script used by my object?
kitfox added the ProgrammingGodot 4.X tags .
- Edited
I just tested get_script() in Godot 4.1.1-stable, and it worked.
Are you sure that the Object exists and has a script attached?
DaveTheCoder I just tried something similar in a different method and I was able to get the script class. I was just creating a new instance of my class and then fetching its script. I don't know what was going wrong before, but it seems it be working now.