Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | L_Tenshi |
Hello!
I have a base scene with 3d spatial node, the node has a mesh that represents the sea and a separate sub-scene which holds my boat.
Test Scene (Main scene) tree
testscene.tscn
–(spatial)Spatial
----(mesh)sea
----(instance spatial)boat
----(camera)camera
Boat scene tree
boat.tscn
–(spatial)boat <–Holds the script
----(rigidbody)RigidBody
------(collisionshape)CollisionShape
--------(meshinstance)BaseModel
The script is very simple
extends Spatial
func _ready():
print("foo")
pass # Replace with function body.
func _process(delta):
print("bar")
pass
The _init function works fine, but the _ready and _process do not. I feel like I should be able to run those two functions, am I missing a piece of the puzzle?
How do you instanced the boat.tscn in the main scene?
nightrobin | 2020-09-08 23:15
Drag and dropped into the scene tree.
L_Tenshi | 2020-09-08 23:21
How did you attached the script in the boat?
Inside the boat’s scene or via the boat subscene while in the main scene?
If I recall correctly, the boat scene script will override the instanced boat scene in the main scene.
So if the boat scene has no script, it will override the instanced boat scene with no script as well.
nightrobin | 2020-09-08 23:48
_init() is also defined in the same simple script you list above?
This should work…
Tim Martin | 2020-09-08 23:49
The script is attached in the boat scene (for easier templating). No overriding script was created on the testscene.
L_Tenshi | 2020-09-09 00:14
At initialization, yes it solves the problem. But what about running per-frame updates? Still no go.
L_Tenshi | 2020-09-09 00:15
I tried it, the _ready and _process works
Let me know after you downloaded it, so that I can delete it in my drive.
nightrobin | 2020-09-09 01:49
Got it. How odd, literally the same setup look
L_Tenshi | 2020-09-09 11:16