/// <summary> /// 获取模型实例对象 /// </summary> /// <param name="resname"></param> /// <param name="callback"></param> /// <param name="loadtype"></param> /// <param name="loadmethod"></param> public void getModelInstance(string resname, Action <GameObject> callback, ResourceLoadType loadtype = ResourceLoadType.NormalLoad, ResourceLoadMethod loadmethod = ResourceLoadMethod.Sync) { ResourceModuleManager.Singleton.requstResource( resname, (abi) => { var modelinstance = abi.instantiateAsset(resname); #if UNITY_EDITOR ResourceUtility.FindMeshRenderShaderBack(modelinstance); #endif callback(modelinstance); }); }
/// <summary> /// 获取一个实例资源对象 /// </summary> /// <param name="respath">资源路径</param> /// <param name="callback">资源回调</param> /// <param name="loadtype">资源加载类型</param> /// <param name="loadmethod">资源加载方式</param> /// <returns></returns> public void getPrefabInstance(string respath, Action <GameObject> callback = null, ResourceLoadType loadtype = ResourceLoadType.NormalLoad, ResourceLoadMethod loadmethod = ResourceLoadMethod.Sync) { ResourceModuleManager.Singleton.requstResource(respath, (abi) => { var assetname = Path.GetFileName(respath); var prefabinstance = abi.instantiateAsset(assetname); #if UNITY_EDITOR ResourceUtility.FindMeshRenderShaderBack(prefabinstance); #endif callback?.Invoke(prefabinstance); }, loadtype, loadmethod); }
/// <summary> /// 获取一个UI实例资源对象 /// </summary> /// <param name="resname">资源名</param> /// <param name="assetname">Asset名</param> /// <param name="callback">资源回调</param> /// <param name="loadtype">资源加载类型</param> /// <param name="loadmethod">资源加载方式</param> /// <returns></returns> public void getUIInstance(string resname, string assetname = null, Action <GameObject> callback = null, ResourceLoadType loadtype = ResourceLoadType.NormalLoad, ResourceLoadMethod loadmethod = ResourceLoadMethod.Sync) { if (string.IsNullOrEmpty(assetname)) { assetname = resname; } ResourceModuleManager.Singleton.requstResource(resname, (abi) => { var uiinstance = abi.instantiateAsset(assetname); #if UNITY_EDITOR ResourceUtility.FindMeshRenderShaderBack(uiinstance); #endif callback?.Invoke(uiinstance); }, loadtype, loadmethod); }