Particle Effect in Asset Bundle crashes when loading level (iOS device only)

I have a project which loads levels from online using Asset Bundles. This works fine in the editor and on the iPhone simulator, but on an actual device causes a crash when trying to load the level. By selectively removing objects from the level and recreating the Asset Bundle, I was able to narrow it down to the particle effect that I have in the level. Another post (http://forum.unity3d.com/threads/116167-Loading-particle-effects-via-iOS-asset-bundles) seems to suggest that this may be a problem with iOS loading particle effects from Asset Bundles, but the error in that post is different from the error I’m getting.

The error I get is:

Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)
at:
Unity::GameObject::GetSupportedMessagesRecalculate()
Unity::GameObject::GetSupportedMessages() [inlined]
Unity::GameObject::SetSupportedMesagesDirty()

I had the exact same particle effect working when the level was included in the project export, so I’m pretty sure the problem is not with the particle effect itself.

It’s worth noting that my project setup in XCode involves including the Unity project within a larger iOS project, but I had that all working fine before switching to Asset Bundles, so I don’t think that’s related to the problem.

Any thoughts on what’s causing this?

Thanks!

I managed to get around this by making my particle effect a prefab, and replacing it with a “loader” object in my actual scene. The loader object then instantiates the prefab at runtime. This way the actual particle effect is included in the exported project instead of the asset bundle.

I still don’t have an explanation, so if anyone knows what caused the issue in the first place, I’d be interested to hear it!

I also meet same problem when load a scene ,help!!

2019 and I’m getting the same problem, albeit on Android (haven’t tested iOS yet). I guess technically I could just move it to the Resources folder, like was suggested, but that means every time I want to add a new particle effect I have to force my users to upgrade the game from the app store, plus I’d have to prepare a new release. I already have to do this whenever a new feature comes in, as code cannot be placed in AssetBundles on mobile (grrrr… but I guess security is the issue), but I thought at least I could include any number of non-script prefabs in my AssetBundles no problem.

EDIT: I think I figured it out. I remember a while ago there were some well-hidden settings about pre-loaded somthings that I had to set, which is many people encounter the “my prefab is pink when loaded from AssetBundle” error. I stumbled upon it again (Project Settings > Graphics > Built-in Shader Settings / Shader Preloading) and saw it was a list of included and pre-loaded SHADERS. I had a look at the particle effect(s) causing problems, and they were using “/Mobile/Particles/Alhpa Blended”, and that was not added to the list of “always included shaders”. So apparently non-particle shaders fail gracefully in that they shoot out an error or warning while just showing up pink, but for particle shaders, it compiles fine, no warnings, but bricks the app when loaded on a device.

I hope this helps someone else, because I’ve been on this problem for nearly 4 days now. I really wish Unity had better documentation where it describes in very technical detail what every little button and option does, as well as step-by-step instructions with common pitfalls for every common thing (like AssetBundles). And it would be nice if the forums/answers were better-kept. Most of the entries are super old and no longer relevant or absolute beginners asking the same questions “how do I load a new scene in code?” or “how do I set up a timer?” (which they wouldn’t have to ask if the documentation was good enough) and very few threads have real answers. Mostly some hack from 2013 that is ultra-deprecated. I know this probably isn’t the place to air out my grievances, but nobody at Unity will probably read this, so…

And lastly, I totally understand the new software model is “Agile”, meaning we get weekly releases with bugfixes and new features and updates instead of months or years between releases on the old “Enterprise” software paradigm, but at what cost? It’s not just Unity - google, Apple, Microsoft - every big player does this and it means we lack (good) documentation, forums are basically “OK, check the next few updates” and if there’s a solution presented, it is invalid within a year. Sucks to be an old-school programmer in modern times sometimes…

2ND EDIT: I may have spoke too soon. Still it crashes when instantiating a particle effect from AssetBundle on mobile device. I guess now I’m going to either have to just not use particle effects or I’ll have to figure out how to debug with Android Studio or maybe might have to buy VisualStudio (as VS Code seems to not be able to debug the debug APK)

Or you can report the bug properly. But you know that would be bad, because maybe Unity would be notified about the problem and they may investigate it. And maybe, after a while if it is really a bug in the software and not a user error, they may, I don’t know… fix it. And then there would be nothing to rant about. And that would be bad.

Seriously. File a bug report with minimal project for reproduce the problem. Unity in general fairly good at tackling them.