- Home /
Question by
tungula1 · Sep 26, 2014 at 11:07 AM ·
javascript
Instantiate GameObject in unity
This part of script works in editor, but in WindowsPlayer get Object reference error, can anybody help?
WWW download= new WWW ("URL"); yield return download;
AssetBundleCreateRequest assetBundleCreateRequest = AssetBundle.CreateFromMemory(download.bytes); yield return assetBundleCreateRequest;
AssetBundle assetBundle = assetBundleCreateRequest.assetBundle; yield return assetBundle;
try { GameObject go = Instantiate(assetBundle.Load("objectName",typeof(GameObject))) as GameObject; } catch(Exception e) { ErrorLoger.Log(e.ToString()); }
Comment
First, format your code. Edit your question, select your code and use the 101/010 button. Next, include a copy of your error message from the console. Then, since you are using a code fragment, show us what line is generating the error.
As a completely wild guess, is ErrorLoger
meant to be ErrorLogger
?
Answer by tungula1 · Sep 26, 2014 at 01:57 PM
Problem is in AssetBundle assetBundle = assetBundleCreateRequest.assetBundle; yield return assetBundle;
, can not get asset bundle
Your answer
![](https://koobas.hobune.stream/wayback/20220613163820im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How to get the velocity of an object 1 Answer
UnityScript How to Detect Movement from FPS Controller 0 Answers
Spawn error 2 Answers