Entitas icon indicating copy to clipboard operation
Entitas copied to clipboard

There is no observers , if deactivate "Reload domain" in Project Settings -> Editor

Open Sergan4ik opened this issue 3 years ago • 1 comments

Hi,

I found a bug, when you replay game in editor without "Reload Domain" option , there is no context observers in DontDestroyOnLoad

Inspector, after reload domain (any change in code) image

Inspector, if code the same, but starts game once more time image

If create observers manually, entities is duping , and can't collapse observers in inspector First time: image Second: image Third: image

etc

Sergan4ik avatar Jun 09 '22 19:06 Sergan4ik

Resetting Context in Start Worked for me.

_contexts = Contexts.sharedInstance;
_contexts.Reset();

another solution is creating a new Context in Start

DeusExMachina1993 avatar Jun 18 '22 05:06 DeusExMachina1993

potential duplicate #967

sschmid avatar Sep 07 '22 09:09 sschmid

The reason is because turn off"Reload domain" would not reset those static fields. Add this code somewhere should fix this problem.

    [InitializeOnEnterPlayMode]
    public static void ReloadContext()
    {
        Contexts.sharedInstance = null;
    }

or @sschmid have time to modify generator generate this one in context. I would like to help but have no idea howto..

eterlan avatar Feb 12 '23 06:02 eterlan