- Home /
Question by
VictorPinto90 · Apr 04, 2014 at 04:14 AM ·
assetbundledllassembly
How to auto find a component inside an assembly (dll)?
I'm first downloading the assembly
private IEnumerator DownloadScripts(){
string url = "http://www.zzzzz.com/scripts.dll"; //here is tocame code
WWW wwwScripts = new WWW(url);
yield return wwwScripts;
Assembly assem = Assembly.Load(wwwScripts.bytes);
System.Type[] TYPES = assem.GetTypes();
}
Then a assetbundle that contain a reference to a component (tocame):
private IEnumerator DownloadAssetBundle(){
WWW wwwAssetBundle;
string url = "http://zzzz.com/Cubes.unity3d";
wwwAssetBundle = new WWW(url);
yield return wwwAssetBundle;
AssetBundle bundle = wwwAssetBundle.assetBundle;
AssetBundleRequest request = bundle.LoadAsync("MainSC",typeof(GameObject));
yield return request;
Instantiate(request.asset) as GameObject;
}
How can I force to Unity to find the script dependence into my TYPES Array (see code)or any way to achieve this?
I don't want to use Assembly.GetType("Tocame") and then AddComponent because Tocame component in assetbundle has public variables set in inspector.
error unity.png
(25.6 kB)
Comment
how did u build the dll? does it have reference to unity-engine.dll(doesnt matter though!)
as it says does it have any #ifdef tht is not related to the platform? is it build for .net 2.0
I'm building the dll from $$anonymous$$ono Command Prompt. This dll contents all monobehaviour scripts that an GameObject needs.