Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | VictorSeven | |
Old Version | Published before Godot 3 was released. |
Hello all,
I am working in a project with Godot. The thing is that I have three scenes that are very similar between them. Basically, they have the same node structure, and mostly the same content in the scripts. So I decided to create a class: particle_class.gd
, which extends RigidBody
.
Then, the three scenes (which are RigidBodies) have a script attached, that extends particle_class.gd
. Until this point, everything is fine.
But now, I want to make an instance of the children scenes. Then, inside particle_class.gd
, I have something like:
var particle = preload("../scenes/free_particle.tscn")
func do_things():
var aux = particle.instance()
add_child(aux)
When I try to compile this, I get this cyclic preload error:
Parser Error: Script not fully loaded (cyclic preload?): res://scripts/particle_class.gd
I imagine that this is coming from the fact that when I load free_particle.tscn
, this tries to extends particle_class.gd
, which iteratively tries to load again the free_particle
scene.
My question is: how to avoid the cyclic preload error?
I get the same when extending another script - but only if the other script has an error.
Check your script to see if this could be the possible solution.
The other fix I believe has something to do with class names and a engine bug … in 3.1 I believe
crazyhat62 | 2020-07-24 09:35