Don't Destroy On Load the Factories
This commit is contained in:
parent
e2c1f186af
commit
03499d4692
|
@ -22,7 +22,12 @@ namespace Syntriax.Modules.Movement.Config
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
GameObject factoriesGO = GameObject.Find("Factories") ?? new GameObject("Factories");
|
||||||
_instance = new GameObject(Name).AddComponent<MovementDefinitionFactory>();
|
_instance = new GameObject(Name).AddComponent<MovementDefinitionFactory>();
|
||||||
|
_instance.transform.SetParent(factoriesGO.transform);
|
||||||
|
DontDestroyOnLoad(factoriesGO);
|
||||||
|
}
|
||||||
|
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,12 @@ namespace Syntriax.Modules.Movement.Config
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
|
{
|
||||||
|
GameObject factoriesGO = GameObject.Find("Factories") ?? new GameObject("Factories");
|
||||||
_instance = new GameObject(Name).AddComponent<MovementFactory>();
|
_instance = new GameObject(Name).AddComponent<MovementFactory>();
|
||||||
|
_instance.transform.SetParent(factoriesGO.transform);
|
||||||
|
DontDestroyOnLoad(factoriesGO);
|
||||||
|
}
|
||||||
|
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue