- Home /
Loading texures from client-owned PNG files in Mirror
This may be a tricky one, but I'm fairly new to C sharp and even newer to Mirror. I'm trying to make a function that allows clients on a server to upload PNG files sourced from a Directory string with a loop like this:
     {
     foreach (string gameobject in string list)
                     {
           GameObject = Instantiate(spawnableprefab);
                         byte[] bytes = File.ReadAllBytes(gameobject);
                     Texture2D texture = new Texture2D(1, 1);
                         texture.LoadImage(bytes);
                         gamobjectimage = GameObject.GetComponent<Image>();
                         gamobjectimage.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f));
 NetworkServer.Spawn(GameObject, connectionToClient);
                 }
     }
From my understanding this code fails from the very start because instantiated objects need to be sourced from the server and "requested" from the client using [Command]. So is there a method to allow a client to upload a string of objects to the server to access at run-time, and specifically upload PNGs from the client's PC with this method?
Thanks :D
Your answer
 
 
             Follow this Question
Related Questions
Sending image data through SyncVar doesn't work (Mirror Networking) 0 Answers
Unet/Mirror. Spawn different prefab in local and server/rest of clients 0 Answers
InvalidProgramException: Invalid IL code? Mirror 0 Answers
Toggle between Animation states over a network 0 Answers
Why is the position of this object not syncing across the network? 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                