Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using Zenject;
- namespace Tests
- {
- [DefaultExecutionOrder(-9990)]
- [RequireComponent(typeof(GameObjectContext))]
- public class GameObjectContextRunner : MonoBehaviour
- {
- #region MonoBehaviour
- private void Awake() => Run();
- #endregion
- private void Run()
- {
- GameObjectContext gameObjectContext = GetComponent<GameObjectContext>();
- if (gameObjectContext.Initialized)
- return;
- DiContainer parentContainer = ProjectContext.Instance.Container
- .Resolve<SceneContextRegistry>()
- .GetContainerForScene(gameObject.scene);
- gameObjectContext.Construct(parentContainer);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement