using UnityEngine; namespace ET.Client { [Event(SceneType.Current)] public class AfterUnitCreate_CreateUnitView: AEvent { protected override async ETTask Run(Scene scene, AfterUnitCreate args) { Unit unit = args.Unit; // Unit View层 string assetsName = $"Assets/Bundles/Unit/Unit.prefab"; GameObject bundleGameObject = await scene.GetComponent().LoadAssetAsync(assetsName); GameObject prefab = bundleGameObject.Get("Skeleton"); GlobalComponent globalComponent = scene.Root().GetComponent(); GameObject go = UnityEngine.Object.Instantiate(prefab, globalComponent.Unit, true); go.transform.position = unit.Position; unit.AddComponent().GameObject = go; unit.AddComponent(); await ETTask.CompletedTask; } } }