using System; using System.Collections.Generic; #if !NOT_UNITY3D using UnityEngine; #endif namespace Zenject { // You can optionally inject this interface into your classes/factories // rather than using DiContainer which contains many methods you might not need public interface IInstantiator { // Use this method to create any non-monobehaviour // Any fields marked [Inject] will be set using the bindings on the container // Any methods marked with a [Inject] will be called // Any constructor parameters will be filled in with values from the container T Instantiate(); T Instantiate(IEnumerable extraArgs); object Instantiate(Type concreteType); object Instantiate(Type concreteType, IEnumerable extraArgs); #if !NOT_UNITY3D // Add new component to existing game object and fill in its dependencies // NOTE: Gameobject here is not a prefab prototype, it is an instance TContract InstantiateComponent(GameObject gameObject) where TContract : Component; TContract InstantiateComponent( GameObject gameObject, IEnumerable extraArgs) where TContract : Component; Component InstantiateComponent( Type componentType, GameObject gameObject); Component InstantiateComponent( Type componentType, GameObject gameObject, IEnumerable extraArgs); T InstantiateComponentOnNewGameObject() where T : Component; T InstantiateComponentOnNewGameObject(string gameObjectName) where T : Component; T InstantiateComponentOnNewGameObject(IEnumerable extraArgs) where T : Component; T InstantiateComponentOnNewGameObject(string gameObjectName, IEnumerable extraArgs) where T : Component; // Create a new game object from a prefab and fill in dependencies for all children GameObject InstantiatePrefab(UnityEngine.Object prefab); GameObject InstantiatePrefab( UnityEngine.Object prefab, Transform parentTransform); GameObject InstantiatePrefab( UnityEngine.Object prefab, Vector3 position, Quaternion rotation, Transform parentTransform); // Create a new game object from a resource path and fill in dependencies for all children GameObject InstantiatePrefabResource(string resourcePath); GameObject InstantiatePrefabResource( string resourcePath, Transform parentTransform); GameObject InstantiatePrefabResource( string resourcePath, Vector3 position, Quaternion rotation, Transform parentTransform); // Same as InstantiatePrefab but returns a component after it's initialized // and optionally allows extra arguments for the given component type T InstantiatePrefabForComponent(UnityEngine.Object prefab); T InstantiatePrefabForComponent( UnityEngine.Object prefab, IEnumerable extraArgs); T InstantiatePrefabForComponent( UnityEngine.Object prefab, Transform parentTransform); T InstantiatePrefabForComponent( UnityEngine.Object prefab, Transform parentTransform, IEnumerable extraArgs); T InstantiatePrefabForComponent( UnityEngine.Object prefab, Vector3 position, Quaternion rotation, Transform parentTransform); T InstantiatePrefabForComponent( UnityEngine.Object prefab, Vector3 position, Quaternion rotation, Transform parentTransform, IEnumerable extraArgs); object InstantiatePrefabForComponent( Type concreteType, UnityEngine.Object prefab, Transform parentTransform, IEnumerable extraArgs); // Same as InstantiatePrefabResource but returns a component after it's initialized // and optionally allows extra arguments for the given component type T InstantiatePrefabResourceForComponent(string resourcePath); T InstantiatePrefabResourceForComponent( string resourcePath, IEnumerable extraArgs); T InstantiatePrefabResourceForComponent( string resourcePath, Transform parentTransform); T InstantiatePrefabResourceForComponent( string resourcePath, Transform parentTransform, IEnumerable extraArgs); T InstantiatePrefabResourceForComponent( string resourcePath, Vector3 position, Quaternion rotation, Transform parentTransform); T InstantiatePrefabResourceForComponent( string resourcePath, Vector3 position, Quaternion rotation, Transform parentTransform, IEnumerable extraArgs); object InstantiatePrefabResourceForComponent( Type concreteType, string resourcePath, Transform parentTransform, IEnumerable extraArgs); T InstantiateScriptableObjectResource(string resourcePath) where T : ScriptableObject; T InstantiateScriptableObjectResource( string resourcePath, IEnumerable extraArgs) where T : ScriptableObject; object InstantiateScriptableObjectResource( Type scriptableObjectType, string resourcePath); object InstantiateScriptableObjectResource( Type scriptableObjectType, string resourcePath, IEnumerable extraArgs); GameObject CreateEmptyGameObject(string name); #endif } }