1.全阶段异步加载与AB包预加载2.node加载无效的问题依然存在
This commit is contained in:
@@ -11,18 +11,8 @@ namespace Demo.Game
|
||||
return new GameObject().AddComponent<ParticleEffect>();
|
||||
}
|
||||
|
||||
private List<IEnumerator> AssetBundleLoadings = new();
|
||||
private List<string> AssetBundles = new();
|
||||
private List<GameObject> Prefabs = new();
|
||||
|
||||
public override IEnumerator LoadScript(string script)
|
||||
{
|
||||
yield return base.LoadScript(script);
|
||||
foreach (var loading in AssetBundleLoadings)
|
||||
{
|
||||
yield return loading;
|
||||
}
|
||||
}
|
||||
private readonly List<string> AssetBundles = new();
|
||||
private readonly List<GameObject> Prefabs = new();
|
||||
|
||||
public override IEnumerator UnloadScript()
|
||||
{
|
||||
@@ -45,9 +35,9 @@ namespace Demo.Game
|
||||
<param name=""ab""></param>
|
||||
<param name=""prefab""></param>
|
||||
")]
|
||||
public void Load(string ab, string prefab)
|
||||
public IEnumerator Load(string ab, string prefab)
|
||||
{
|
||||
AssetBundleLoadings.Add(this.LoadAssetBundle(ab, x =>
|
||||
yield return this.LoadAssetBundle(ab, x =>
|
||||
{
|
||||
GameObject sub = Instantiate(x.LoadAsset<GameObject>(prefab));
|
||||
sub.SetActive(false);
|
||||
@@ -55,7 +45,7 @@ namespace Demo.Game
|
||||
sub.transform.SetParent(transform);
|
||||
sub.transform.localPosition = Vector3.zero;
|
||||
AssetBundles.Add(ab);
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
public override void OnBegin()
|
||||
|
||||
Reference in New Issue
Block a user