| 123456789101112131415161718192021 |
- using UnityEngine;
- namespace ET
- {
- public class AfterUnitCreate_CreateUnitView: AEvent<EventType.AfterUnitCreate>
- {
- protected override async ETTask Run(EventType.AfterUnitCreate args)
- {
- // Unit View层
- ResourcesComponent resourcesComponent = Game.Scene.GetComponent<ResourcesComponent>();
- GameObject bundleGameObject = (GameObject)resourcesComponent.GetAsset("Unit.unity3d", "Unit");
- GameObject prefab = bundleGameObject.Get<GameObject>("Skeleton");
-
- GameObject go = UnityEngine.Object.Instantiate(prefab);
- GameObject.DontDestroyOnLoad(go);
- args.Unit.GameObject = go;
- args.Unit.AddComponent<AnimatorComponent>();
- await ETTask.CompletedTask;
- }
- }
- }
|