I was wondering if there is a way to confirm the class of a Node. I'm trying to make one script that can be used on any type of node, checks the Node's class, and sets specific values based on that class.
Basically a more elaborate version of this:
self.modulate = Color(#ffffff)
Sadly doing this gives an error (
error(): The Method "get_stylebox()" isn't declared in the current class), because it extends
Node rather than
Control. It gives this error even though there is no way the
get_stylebox() method will ever call on a non-Control node.
I was hoping there was a way to confirm that self is a
Control node, so
get_stylebox() is a valid Method, or some other way to work around this.
By the way, making the script extend
Control instead, has the issue that the script cannot be used on Sprites or any other non-Control node, so that won't do the trick.