- Home /
Clearing Editor References when Building for Mobile
Ah, memory...
There are many cases where I need to load separate SD/HD assets based on device memory. This usually involves removing the asset reference altogether then using Resources.Load() to load the SD/HD asset.
My scene is getting less and less clean in the editor, because everything isn't hooked up by asset. In most cases, I still have the asset directly (as a Texture2D or whatever), plus a strings for the corresponding Resources.Load() in the same script. Resources.Load() is just an alternative way to init the asset reference. If I forget to clear all these references each time I build, the asset gets included directly in the build, and the app runs out of memory on low-end devices.
Is there a way to invoke a script on build player where I can clear specific asset references, then restore them afterwards?
Thanks, Alex
Answer by Veehmot · Jun 13, 2013 at 12:33 AM
If you want to modify the build for a specific platform, I suggest you take a look at the Build Pipeline functions. That's how we achieved building different assets for Mobile or Desktop.
Your answer
![](https://koobas.hobune.stream/wayback/20220613104046im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to Disable Unloading of Assets During Bundling 0 Answers
AssetGraph bug fixed request(Override Import Setting doesn't work) 0 Answers
Sprites warped/not sliced on android builds, fine in editor 0 Answers
Unity Custom Inspector - Resources.LoadAll() returns 0 element. 1 Answer
Mesh Destroy After an Editor Stop 0 Answers