Skip to main content
Edit title. OP's actual problem is an invalid call in their code, not an issue with the engine's core features
Link
liggiorgio
  • 5.5k
  • 6
  • 27
  • 38

Error when calling function from script using class_name somehow does not specify the type of the node in actual game sessions in Godot 4

Minor grammar fixes, markdown formatting
Source Link
liggiorgio
  • 5.5k
  • 6
  • 27
  • 38

I'm making a mockup desktop for a sandbox game. I have a script, in which I defined a ObjContainerObjContainer class that extends the ControlControl class (the ContainerContainer class has some behaviours that i dontI don't want). I attached the said scirptscript to the node "ObjContainer". When I check it in the localLocal tab of the node treeScene Tree, it shows that the "ObjContainer" node has a typeis of ObjContainertype ObjContainer as intended, shown in picture 1. When I ran the scene, I noticed that the "ObjContainer" has now suddenly turned into a ControlControl node, shown in picture 2.*

* Edit: All nodes with custom class seemsseem to have this behaviour. theThe remote tree always show native node types that I extend from. theThe real issue is as follows:

Calling ObjContainerObjContainer-exclusive functions brings up an error that says:

"ObjContainer" node with the type ObjContainer   

"ObjContainer" node with the type Control

whyWhy does it do that? everyEvery single custom-class-exclusive callscall worked perfectly fine previously. I even commented out the request_select()request_select() line and it ran smoothly. what'sWhat's up with my ObjContainerObjContainer?

theThe following is the script from the node calling the function:

andAnd the script from the ObjContainer class:

I'm making a mockup desktop for a sandbox game. I have a script, in which I defined a ObjContainer class that extends the Control class (the Container class has some behaviours that i dont want). I attached the said scirpt to the node "ObjContainer". When I check it in the local tab of the node tree, it shows that the "ObjContainer" node has a type of ObjContainer as intended, shown in picture 1. When I ran the scene, I noticed that the "ObjContainer" has now suddenly turned into a Control node, shown in picture 2.*

* Edit: All nodes with custom class seems to have this behaviour. the remote tree always show native node types that I extend from. the real issue is as follows:

Calling ObjContainer-exclusive functions brings up an error that says:

"ObjContainer" node with the type ObjContainer  "ObjContainer" node with the type Control

why does it do that? every single custom-class-exclusive calls worked perfectly fine previously. I even commented out the request_select() and it ran smoothly. what's up with my ObjContainer?

the following is the script from the node calling the function:

and the script from the ObjContainer class:

I'm making a mockup desktop for a sandbox game. I have a script, in which I defined a ObjContainer class that extends the Control class (the Container class has some behaviours that I don't want). I attached said script to the node "ObjContainer". When I check it in the Local tab of the Scene Tree, it shows that the "ObjContainer" node is of type ObjContainer as intended, shown in picture 1. When I ran the scene, I noticed that the "ObjContainer" has now suddenly turned into a Control node, shown in picture 2.*

* Edit: All nodes with custom class seem to have this behaviour. The remote tree always show native node types that I extend from. The real issue is as follows:

Calling ObjContainer-exclusive functions brings up an error that says:

"ObjContainer" node with the type ObjContainer 

"ObjContainer" node with the type Control

Why does it do that? Every single custom-class-exclusive call worked perfectly fine previously. I even commented out the request_select() line and it ran smoothly. What's up with my ObjContainer?

The following is the script from the node calling the function:

And the script from the ObjContainer class:

added 2 characters in body
Source Link

* Edit: All nodes with custom class seems to have this behaviour. the remote tree always show native node types that I extend from. the real issue is as follows:* Edit: All nodes with custom class seems to have this behaviour. the remote tree always show native node types that I extend from. the real issue is as follows:

* Edit: All nodes with custom class seems to have this behaviour. the remote tree always show native node types that I extend from. the real issue is as follows:

* Edit: All nodes with custom class seems to have this behaviour. the remote tree always show native node types that I extend from. the real issue is as follows:

added 169 characters in body
Source Link
Loading
Source Link
Loading