/// <summary> /// Replaces the contents of an existing Texture2D with an image from the downloaded data. /// </summary> /// <param name="tex">An existing texture object to be overwritten with the image data.</param> public void LoadImageIntoTexture(Texture2D tex) { if (tex == null) { throw new Exception("Texture is null"); } if (type == RequestType.www) { #if UNITY_2018_3_OR_NEWER tex.LoadImage(bytes); #else www.LoadImageIntoTexture(tex); #endif } else { tex.LoadImage(_bytes); } }