linux下用python做网站,烟台响应式网站建设,做网站销售怎么样,网推所是什么意思个人尝试的结果#xff0c;不一定为正规的操作#xff0c;若观者有更好的方案#xff0c;望赐教。 1.第三方框架应该放在哪里#xff1f; 以热更框架为例#xff0c;入口函数进入后#xff0c;需要调用热更代码检查资源#xff0c;更新资源#xff0c;加载程序集。测试… 个人尝试的结果不一定为正规的操作若观者有更好的方案望赐教。 1.第三方框架应该放在哪里 以热更框架为例入口函数进入后需要调用热更代码检查资源更新资源加载程序集。测试1把热更框架放到Assembly-CSharp.dll主工程中会发现其他的热更asmdef无法引用热更框架代码结果失败。测试2把热更框架单独生成asmdef放到热更asmdef列表然后其他热更asmdef进行引用主工程生成admdef也对其进行引用结果打包时报错提示主工程引用了引用工程结果失败。测试3依然把热更框架单独生成asmdef但是不放在热更asmdef列表而是放在Assembly-CSharp文件夹然后其他热更资源再对其进行引用此时因为热更框架本身就在Assembly-CSharp文件夹所以主工程不需要再设置成asmdef可以直接使用结果成功 2.Could not load type XxxType from assembly yyyAssembly 官方文档已经给了几个解决方式这里主要说下 “yyyAssembly是热更新assembly” 这种情况使用场景是在A的asmdef中调用B的asmdef中的类此时A是需要引用B的以以下代码为例其中hotfixtest脚本位于A的asmdefhotupdate3test位于B的asmdef。
public class HotFixTest : MonoBehaviour
{void Start(){Debug.Log($---?????HotFixTest?????--- {gameObject.name});Model.Assetbundle.AssetbundleLoader.I.Load(dlls/hotupdatedlls/hotupdate3.dll.ab, (holder) {GameObject go new GameObject(HotUpdate3Test);go.AddComponentHotUpdate3Test();},(error) {Debug.Log(error.errorMessage);});}
}
public class HotUpdate3Test : MonoBehaviour
{void Start(){Debug.Log( this is hot update 3 );}
} 这样写就会报上面的错Could not load type-----。是因为A依赖了B那么在加载AAssembly.Load之前要先加载B。但实际情况是A作为最先启动的热更Asmdef加载代码是写在主项目里的没办法热更代码此时可以换一种方式通过反射加载代码示例如下其中新加脚本HotUpdate3_1为B的asmdef中的另一个类也可以加载到。
public class HotFixTest : MonoBehaviour
{void Start(){Debug.Log($---?????HotFixTest?????--- {gameObject.name});Model.Assetbundle.AssetbundleLoader.I.Load(dlls/hotupdatedlls/hotupdate3.dll.ab, (holder) {Assembly hotUpdate3Ass Assembly.Load(holder.LoadAssetTextAsset().bytes);Type entryType hotUpdate3Ass.GetType(HotUpdate3Test);entryType.GetMethod(Test).Invoke(null, null);},(error) {Debug.Log(error.errorMessage);});}
}
public class HotUpdate3Test : MonoBehaviour
{void Start(){Debug.Log( this is hot update 3 );}public static void Test(){Debug.Log( this is hot update 3 Test);GameObject go new GameObject(HotUpdate3Test);go.AddComponentHotUpdate3Test();GameObject go2 new GameObject(HotUpdate3_1);go2.AddComponentHotUpdate3_1();}
}
public class HotUpdate3_1 : MonoBehaviour
{void Start(){Debug.Log( this is hot update 3_1 );}
} 按照上面的写法就可以实现不打包新增热更的asmdef了。