Sprite sprite = Sprite.Create(tex, new Rect(0.0f, 0.0f, tex.width, tex.height), pivot, 100. UnityWebRequest www = UnityWebRequest.Get(url) Check if we should use UnityWebRequest or File.ReadAllBytes Url = Path.Combine(Application.streamingAssetsPath, "shareImage.png") ![]() /url = Application.dataPath + "/StreamingAssets/shareImage.png" Cisco delivers innovative software-defined networking, cloud, and security solutions to help transform your business, empowering an inclusive future for. This is not the issue now since you're running it in the Editor but will be in a build.īelow is what your code for reading image file in the StreamingAssets should look like: using UnityEngine.Networking This means that you will have to Convert the Texture2D to Sprite then assign that sprite to the SpriteRenderer.sprite property.įinally, use Application.streamingAssetsPath when accessing files in the StreamingAssets folder. The proper way to change a sprite of a SpriteRenderer is to change the SpriteRenderer.sprite property. Note that you should now be using UnityWebRequest where The material will reflect the images changes but the SpriteRenderer will not. This should solve the question mark issue. ![]() ![]() While reading files in the StreamingAssets folder, you have to use You check if the path contains :// or :/// then determine which one to use.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |