- Home /
IL2CPP Crash on Instantiate(gameObject)
I get a crash on iOS build with IL2CPP when try to Instantiate(gameObject) http://monosnap.com/image/mTYjRTom9DLjnIpVjQB31041O19uXm http://monosnap.com/image/Z8pzLNnrXkDvg3vwe12AKkwalh53z2 http://monosnap.com/image/HfY0ZHjjVlM4ZiskjFOLER25MiH54q http://monosnap.com/image/LzXIhp4DGT56aYkbYNVVCarfB0Cmi3
P.S. gameObject was preloaded from assetbundle
What am I doing wrong? )
It is difficult to tell what the cause of the problem is from these screen shots, sorry. Please make sure that you are using the latest patch release version (available here: http://unity3d.com/unity/qa/patch-releases). If the problem still occurs, this is likely a bug in IL2CPP. Can you then submit a bug report?
Answer by Lex_Dudya · Jul 10, 2015 at 08:36 AM
I figured out that bug can be workaround. Something strange happend with Instantiate(gameObject). I use Instantiate(gameObject) to clone objects loaded from assetbundles. If I load prefab from assetbundle without script (just GO, material and mesh), and attach script with Instantiate(this) code in runtime (via AddComponent), then crash happens.
BUT, If i attach script to prefab before building assetbundles, and load prefab from assetbundle with script have been already attached, the instantiate(this) works fine.
I hope it may be useful.
P.S. The bug submitted via link http://fogbugz.unity3d.com/default.asp?706370_3lkfsifd0iv5psdn