Example #1
0
        public static Sprite ReadSprite(this NetworkReader reader)
        {
            // support 'null' textures for [SyncVar]s etc.
            // https://github.com/vis2k/Mirror/issues/3144
            Texture2D texture = reader.ReadTexture2D();

            if (texture == null)
            {
                return(null);
            }

            // otherwise create a valid sprite
            return(Sprite.Create(texture, reader.ReadRect(), reader.ReadVector2()));
        }
Example #2
0
 public static Sprite ReadSprite(this NetworkReader reader)
 {
     return(Sprite.Create(reader.ReadTexture2D(), reader.ReadRect(), reader.ReadVector2()));
 }