protected void Awake() { TinyContainer container = TinyContainer.For(this); foreach (Object obj in objects) { container.Register(obj.GetType(), obj); } }
private bool TryGetNextContainerInHierarchy(out TinyContainer container) { if (this == _global) { container = null; return(false); } container = transform.parent.IsNull()?.GetComponentInParent <TinyContainer>().IsNull() ?? ForSceneOf(this); return(true); }
internal void ConfigureAsGlobal(bool dontDestroyOnLoad) { if (_global != null && _global != this) { Debug.LogError("TinyContainer Global has already been configured.", this); return; } _global = this; if (dontDestroyOnLoad) { DontDestroyOnLoad(_global); } }
private static void ResetStaticFields() { _global = null; _sceneContainers = new Dictionary <Scene, TinyContainer>(); _temporarySceneGameObjects = new List <GameObject>(); }