- Home /
Assign a Material temporary (Will function in the built layer)
Hello, I am having trouble assigning a material temporary to a directory which will function in the built layer. I am trying to get the client assign a few pictures which it downloads (Coverd the texture downloading allready) temporary so when the application ends whould be removed.
The problem is that I cannot use "AssetDatabase" to assign the material because it wont function in the standalone build and fits only for the "editor" section.
How do I get it to store temporary a material asset?
Answer by Statement · Dec 20, 2012 at 09:01 PM
You wouldn't serialize materials at runtime, at least it's nothing that I can see we have built in support for. What you can do however is to serialize the properties you want to store yourself. You can create materials at runtime and get/set properties on them.
http://docs.unity3d.com/Documentation/ScriptReference/Material.html
Or you could just have a few pre made materials without textures in Resources which you can load, and then assign the texture when you have loaded it.
The thing is that I work over a $$anonymous$$ultiplayer game and it requires to download 4 pictures of each client which is in the room and I guess 32 * 4 whould be 128 materials to assign in the WORST CASE scenario so I guess making 128 materials and assigning the downloaded texture on them whould be silly.. I dont $$anonymous$$d to store temporary textures ins$$anonymous$$d of materials. :P
Answer by benk0913 · Dec 21, 2012 at 08:15 AM
SOLVED, I assigned the 4 textures to each of the players gameobjects. Many thanks!