Example #1
0
        public static void InjectUnsetPropertiesForGameObject(
            GameObject gameObject,
            Action <ContainerBuilder> configurationAction,
            IEnumerable <Parameter> parameters)
        {
            AssertContainerIsSet();

            var scope = Container.BeginLifetimeScope(builder =>
            {
                builder
                .Register(_ => gameObject)
                .As <GameObject>()
                .InstancePerLifetimeScope();

                TagDependencies.ExecuteConfigurationActionsForTag(gameObject.tag, builder);
                configurationAction(builder);
            });

            foreach (var monoBehaviour in gameObject.GetComponentsInChildren <MonoBehaviour>())
            {
                scope.InjectUnsetProperties(monoBehaviour, parameters);
            }
        }
Example #2
0
 public static void ForTag(string tag, Action <ContainerBuilder> configurationAction) =>
 TagDependencies.AddConfigurationActionForTag(tag, configurationAction);