0 votes

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?

in Engine by (15 points)

How do you instanced the boat.tscn in the main scene?

Drag and dropped into the scene tree.

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.

_init() is also defined in the same simple script you list above?

This should work...

The script is attached in the boat scene (for easier templating). No overriding script was created on the testscene.

At initialization, yes it solves the problem. But what about running per-frame updates? Still no go.

I tried it, the _ready and _process works
Let me know after you downloaded it, so that I can delete it in my drive.

Sample Project
Screenshot

Got it. How odd, literally the same setup look

1 Answer

+1 vote
Best answer

Hi L_Tenshi,

Thanks for sharing the project, needed in this case.

The problem is that your instance of U96 in testscene has overridden the script parameter to be empty.

Click this circle-arrow button to remove the override and it works.

Script override

by (392 points)
selected by

You sir are amazing. I've got to admit, I should have seen that coming from unity. Godot so far seems amazing, but I guess there are some quirks I've got to learn.

Thanks for the help, I was scratching my head all day yesterday!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.