void Awake() { _singletonComponent = new SingletonComposition <UserManager>(Instance, () => Instance = this, () => Destroy(this.gameObject)); string fileName = $"{Application.persistentDataPath}/playerData_{gamePrefsName}.dat"; _fileSaveSystem = new FileSaveSystem(fileName); }
/// <summary> /// Accepts the <see cref="SingletonRegistration"/> to visit. /// </summary> /// <param name="registration">The <see cref="SingletonRegistration"/> to visit.</param> public void Accept(SingletonRegistration registration) { if (registration == null) { throw new ArgumentNullException(nameof(registration)); } // Visit the inner registration which will add a composition. _manager.Visit(registration.Inner); // Get the original composition, removing it to allow it to be replaced. IComposition inner = _container.RemoveComposition(registration.ImplementationType); // Replace the inner composition. IComposition composition = new SingletonComposition(inner); _container.AddComposition(composition); }
private void Awake() { _singletonComponent = new SingletonComposition <MenuManager>(Instance, () => Instance = this, () => Destroy(this.gameObject)); }