0 votes

Hi, i have a problem, i'm making a position list that uses linked nodes, the thing is that if define the static type of a parameter with the same type of the class that is implementing the function gdScript will take it as cyclic reference

extends Node
class_name NodoPL 
var element
var nodo_previo
var nodo_siguiente

func _init(e, prev: NodoPL, next: NodoPL):
   element = e
   nodo_previo = prev
   nodo_siguiente = next

this wont cause any error but the class that preloads NodoPL will say

couldn't fully preload the script, posible cyclic reference or compliation error. use load() if a cyclic reference is intended

if i use load is still have the error but when i use the class for static typing

in Engine by (14 points)

1 Answer

0 votes

Hi,
this is perfectly fine when i test it.

Godot has some sort of class caching and makes some weired things when changing class names and alike. Saving reloading or rewriting(copy paste) the scripts mostly fixes this issues.
Dont know exactly what causes those flaws.

by (3,930 points)

so i should ignore the error?

well, you cant when its not compiling. But i have put your provided code into a project and its states no error.
Are you sure the error is located there?

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.