0

I am recently started working with Unity3D, I am working with Unity3D version 5.3.0;

I have sprite object in my application, currently I am importing image and converting its texture type from texture to sprite. and the manually liking it with sprite renderer of my sprite object.

I want to change sprite (2D texture) in sprite renderer at the runtime. and the texture file (png image) is stored on my server.

using www class I can download it in a texture file but the question is, How i can convert the texture type from texture to sprite before assigning it to sprite?

1 Answer 1

1

When you say that you can download the texture, do you manage to get a unity object (such as a Texture2D), or just the image file downloaded on your computer?

If you managed to get a unity texture object, you can have a look at the Sprite.Create function

If you just get the file, I think this isn't enough to convert it to a correct Unity object. You should prepare an Unity asset bundle containing your sprite (have a look on google, there is plenty of info about asset bundles) and store the asset bundle on your server. This way you can download usable unity objects (for instance, a Sprite)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.