/******************************************************************** 文件: LoaderTools.cs 作者: 梦语 邮箱: 1982614048@qq.com 创建时间: 2024/03/29 17:28:19 最后修改: 梦语 最后修改时间: 2024/04/12 16:55:51 功能: 加载资源 *********************************************************************/ using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Ether { public static class LoaderTools { public static T LoadAsset(string assetName) where T : Object { return Resources.Load(assetName); } public static GameObject LoadGameObjectAndInstantiateAsync(string assetName, Transform parent = null) { GameObject asset = Resources.Load(assetName); GameObject go = GameObject.Instantiate(asset, parent); if (go != null) { go.name = go.name.Replace("(Clone)", ""); } return go; } public static GameObject Instantiate(GameObject asset, Transform parent = null) { GameObject go = GameObject.Instantiate(asset, parent); if (go != null) { go.name = go.name.Replace("(Clone)", ""); } if (!go.activeSelf) { go.SetActive(true); } return go; } } }