-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node type doesn't change to script's #85485
Comments
I believe this is intentional due to bug reports about the opposite problem (changing the node type but not the script type): #79203 You need to right-click the node in the scene hierarchy and change its type. |
To add to that, a script extending Node3D wouldn't work on a node of a more general type. The node has no idea about more specific methods and properties this introduces. Only the other way around is possible. |
Isn't this the issue though, that I can have a script extending Node3D on a Node and it's not immediately obvious why it's not working? Genuine question: what use cases are there for having a script be a different type to the Node? I'm not sure I understand the presented case in the issue Deozaan linked. How is behaviour managed in the relationship? e.g.: if you put a script extending CharacterBody3D on a plain Node, is the resulting behaviour defined? |
It should be obvious when you run the scene, there should be an error. I agree that it would also be good to show some kind of warning in the Scene dock as well in this case.
If your script is of a broader type than your node (e.g. script is
This is the same as your original issue, it's not supported and has no sensible definition. If your node is |
@YuriSizov thanks for indulging me! I think a warning in the Scene dock is probably the ticket here. I stumbled across this because I was inheriting from Node. However, later realised I needed access to 3D-world methods and changed it to inherit Node3D. Obviously the Scene I'd saved with the script (single Node with the script on it) obviously didn't update. A little warning icon if the script is attached to an incompatible type would make sense. Thanks again! |
Godot version
v4.2-beta6
System information
Windows 10
Issue description
If I add a script to a Node, the Node's type doesn't update according to the script. So if I change the script to inherit a Node3D instead of Node, the Node itself doesn't update its type (or at least the icon doesn't change to indicate it has).
Steps to reproduce
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: