remove property from an object

Godot Version



Hi hi hello. I’m aware that you can create new properties on objects at runtime like this:

object["property"] = property_value

Is it also possible to do the reverse, and remove properties from memory? Something vaguely like this?:"property")

I don’t just want to set to null, I want it gone from memory. Dead. Obliterated. Nothing was ever here.

… For clarification, I’m trying to make something like an interface system. Appending Callable methods to an object’s properties seems like one way to get the functionality I want? Would appreciate some input on that if anyone has tried this before. :slight_smile:

How do you mean creating properties in objects? That isn’t possible normally, they need to exist, are you sure these values are assigned correctly? Does print(object["property"] actually print the correct value?

That’s not possible unless you write your own Object._set() and Object._get() functions in the object script that process that property.

You can use Object.set_meta(), Object.get_meta(), Object.has_meta() and Object.remove_meta() to append and remove metadata at runtime.

1 Like