+3 votes

Does anyone know how to add a resource as a 'dependency' of a node? That is when that node is loaded (as part of the scene loading) I also want to load some other resources.

Basically I have my splash screen which uses an interactive loader to load the main game scene. The interactive loader loads all the resources all the nodes in the scene need e.g. if I have a Sprite3d with a specific texture that texture is loaded. But if that sprite3d has a script that lets it switch between three other textures those textures won't be loaded until the first time I try to use them.

I want the interactive loader to recognize those extra textures as 'dependencies' of that sprite3d and load them directly.

I'm not sure if this is how preload works but I'm using C#/Mono so I can't use the preload keyword. (And I haven't found an equivalent.)

in Engine by (26 points)

1 Answer

–1 vote

I guess you could make a script for everything that has those dependencies that holds some code such as:

export(Texture) texture_to_load

then you could call on that custom property in your interactive loader.

by (96 points)

I'm confused, what are you talking about? As far as I can tell the documentation on interactive loader doesn't read random properties of the objects it loads.

You can see for yourself here.

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.