- Home /
File Input
I want the player to be able to upload his own texture for his character, how do I do that? Also, does it matter if other players need to see his character's texture in multiplayer?
Comment
Best Answer
Answer by poisoned_banana · Apr 13, 2018 at 04:50 PM
//Create new Texture
Texture2D tex = new Texture2D(2, 2);
//Load byte[] from file into the texture
tex.LoadImage(File.ReadAllBytes(filePath));
//Set the maintexture of the material to the new texture
yourMaterial.SetTexture("_MainTex",tex);
If other player are supposed to see the texture, you have to find a way to send them the byte[] of the texture