unity-game-engine

Add an image to object in Unity editor


How do I add an image to an empty object? Which component should I add?

I've tried adding an "Image" component but I can't figure out what to do afterwards.


Solution

  • Drag the image you want into the project directory and this will create a sprite from that image. Then drag that image onto the empty gameobject and it will create a sprite renderer component and will automatically add the image as the sprite for the sprite renderer. You can also do this manually by adding the sprite renderer and selecting your image as the sprite for the sprite renderer.


    Note that if you are talking about Unity's UI system, simply do this...

    1. click "Add Canvas"

    2. tip, be sure to select "Scale with screen size" there. (In 99.99999% of cases, you want that option. It's bizarre Unity don't make it the default; just one of those whacky things about Unity.)

    3. simply click "Add Image"

    Add images like the crazy - it's that easy. You'll have to learn to use Unity's (superb) reactive layout system to position stuff on the screen in an advanced way. (Allow 3-4 months of study on that to become a hobbyist-level engineer on that system.)