Change names of objects spawned by installers
This commit is contained in:
@@ -5,6 +5,8 @@ using Zenject;
|
|||||||
|
|
||||||
public class GlobalInstaller : MonoInstaller
|
public class GlobalInstaller : MonoInstaller
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private GameObject musicPlayerPrefab;
|
private GameObject musicPlayerPrefab;
|
||||||
|
|
||||||
@@ -14,20 +16,39 @@ public class GlobalInstaller : MonoInstaller
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private GameObject playerPrefab;
|
private GameObject playerPrefab;
|
||||||
|
|
||||||
|
public override void Start()
|
||||||
|
{
|
||||||
|
base.Start();
|
||||||
|
|
||||||
|
name = "ProjectContext";
|
||||||
|
}
|
||||||
|
|
||||||
public override void InstallBindings()
|
public override void InstallBindings()
|
||||||
{
|
{
|
||||||
Container.Bind<MusicManager>()
|
Container.Bind<MusicManager>()
|
||||||
.FromComponentInNewPrefab(musicPlayerPrefab)
|
.FromComponentInNewPrefab(musicPlayerPrefab)
|
||||||
.AsSingle();
|
.AsSingle()
|
||||||
|
.OnInstantiated<MusicManager>((ctx, obj) =>
|
||||||
|
{
|
||||||
|
obj.name = musicPlayerPrefab.name;
|
||||||
|
});
|
||||||
|
|
||||||
Container.Bind<HVRManager>()
|
Container.Bind<HVRManager>()
|
||||||
.FromComponentInNewPrefab(hvrGlobalPrefab)
|
.FromComponentInNewPrefab(hvrGlobalPrefab)
|
||||||
.AsSingle()
|
.AsSingle()
|
||||||
|
.OnInstantiated<HVRManager>((ctx, obj) =>
|
||||||
|
{
|
||||||
|
obj.name = hvrGlobalPrefab.name;
|
||||||
|
})
|
||||||
.NonLazy();
|
.NonLazy();
|
||||||
|
|
||||||
Container.Bind<HVRObjectCollisionDisabler>()
|
Container.Bind<HVRObjectCollisionDisabler>()
|
||||||
.FromComponentInNewPrefab(playerPrefab)
|
.FromComponentInNewPrefab(playerPrefab)
|
||||||
.AsSingle()
|
.AsSingle()
|
||||||
|
.OnInstantiated<HVRObjectCollisionDisabler>((ctx, obj) =>
|
||||||
|
{
|
||||||
|
obj.name = playerPrefab.name;
|
||||||
|
})
|
||||||
.NonLazy();
|
.NonLazy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,10 @@ public class LevelInstaller : MonoInstaller
|
|||||||
Container.Bind<LevelManager>()
|
Container.Bind<LevelManager>()
|
||||||
.FromComponentsInNewPrefabResource("Managers/LevelManager")
|
.FromComponentsInNewPrefabResource("Managers/LevelManager")
|
||||||
.AsSingle()
|
.AsSingle()
|
||||||
|
.OnInstantiated<LevelManager>((ctx, obj) =>
|
||||||
|
{
|
||||||
|
obj.name = "LevelManager";
|
||||||
|
})
|
||||||
.NonLazy();
|
.NonLazy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user