Cyclic dependency

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SuperDIMMaX

Exist class Mob with

func _on_effect(_effect:Effect)

and class Effect with

var mob:Mob

How fix this?
P.S. Logic next: Mob A generate Node contain Effect and Effect apply on Mob B
(Effect_A.mob = Mob_A) Node with Effects call: Mob_B._on_effect(Effect_A) in this func: _effect.mob.some_stuff()

i found only https://forum.godotengine.org/39973/cyclic-dependency-error-between-actor-and-actor-controller. Exist good solution?

SuperDIMMaX | 2020-12-30 17:26

:bust_in_silhouette: Reply From: SuperDIMMaX

Probality found solution:

extends Reference
class_name Mob

class Effect extends Reference
    var mob:Mob
    func _init()
        pass