• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
11
Question by Helical · Sep 22, 2015 at 12:18 PM · ui

Raw Image vs Image?

I can't understant why Raw Image component exists. In the manual it claims

" you can use it to display any texture available to the Unity player. For example, you might show an image downloaded from a URL using the WWW class or a texture from an object in a game"

However you can create a Sprite from texture with no problem using Sprite.Create(texture);

So the entire of purpose of Raw Image escapes me.

Just wondering if anyone knows of a performance reason or anything of the like?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
35
Best Answer

Answer by steakpinball · Sep 22, 2015 at 01:38 PM

Image is for displaying Sprites only. RawImage is for displaying any type of texture.

Sprites are easier to work with, but Sprite.Create is an expensive operation. It takes a comparatively long time and uses a lot of memory. It should be used sparingly. By using a RawImage you can skip the step of creating a sprite. If displaying something like a RenderTexture using an Image you would need to call Sprite.Create every frame. That would be quite taxing.

Bottom Line: Use RawImage when you already have a plain texture, because converting it to a sprite would be slower and use more memory.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image chilemanga · Jan 26, 2016 at 01:53 PM 1
Share

Thanks for your answer @brianturner, but, can you elaborate a little bit more on when to use what? When to use sprites (Image)? When to use plain texture (Raw Image)?

The only case in which I'm thinking Sprites are a good choice, should be in elements that uses fillAmount (like progress bars or stuff like that). Thanks again!

avatar image fffMalzbier chilemanga · Jan 26, 2016 at 03:50 PM 2
Share

Form the Documentation for RawImage

$$anonymous$$eep in mind that this will create an extra draw call with each RawImage present, so it's best to use it only for backgrounds or temporary visible graphics.

avatar image Rockaso · Nov 26, 2018 at 11:43 PM 0
Share

Excellent, I love bottom lanes

avatar image drew55 · Jul 11, 2019 at 04:39 AM 0
Share

That means the per-frame performance is slower though it seems.

What about if you were loading a large user-provided image (e.g. a high res backdrop) and planned to have it persist for the rest of the user's session? Would it make sense to convert to a Sprite then? How would you go from raw image bytes (e.g. a jpg file) to a Sprite that is ready to go?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

38 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make a square button with rounded corners. 1 Answer

4.6 UI Text rect does not expand automatically 2 Answers

Prevent focus from leaving inputfield 0 Answers

Unity 4.6 button movement problem 1 Answer

Event System Problems 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges