- Home /
Android - sharedMaterial
Hello,
I'm trying to modify a sharedMaterial so that the changes will be saved when opening the app again. This works perfectly within the windows editor. On Android it resets every time I close and reopen the app.
How can I permanently modify assets on Android?
Thanks for your help.
Answer by ArkaneX · Apr 30, 2014 at 03:03 PM
In compiled application assets are packed into a resources file, and you can't modify anything inside this file.
To achieve what you need, you have to save the modified material info, e.g. using PlayerPrefs. When app is reopened, check if anything is saved. If yes, apply the change again.
For example, if you changed the material color, save this color RGBA values and after reopen, recreate a Color, and assign it to shared material.
Thank you for your answer. The Problem with PlayerPrefs is that I have to read the values for all kinds of attributes and change those in the material. The shared$$anonymous$$aterial method in the editor does all of that basically automatically. $$anonymous$$y workaround at the moment is saving and loading to an xml document.