Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Sergan4ik opened this issue Jun 9, 2022 · 3 comments
Labels

Comments

@Sergan4ik
Copy link

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

@DeusExMachina1993
Copy link

DeusExMachina1993 commented Jun 18, 2022

Resetting Context in Start Worked for me.

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

another solution is creating a new Context in Start

@sschmid sschmid added the bug label Aug 25, 2022
@sschmid
Copy link
Owner

sschmid commented Sep 7, 2022

potential duplicate #967

@eterlan
Copy link

eterlan commented Feb 12, 2023

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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

4 participants