- Home /
Image on game object is not being rendered
I am creating a health bar for a 2D game, and would like to use the Image API. I have a sprite to use for the game player's health status, and want to make use of the Image API's Filled property.
I'm having a problem with the image showing up, though. If I create a gameobject, and attach a sprite to it with a sprite renderer, then I have no problems and it shows up fine. However, if I attach an image to a gameobject, and the sprite to that image, the image doesn't show up in the scene or in the game, and Z-layering does not appear to be an issue.
What am I doing wrong that is making my image not render?
Answer by jwinskill · Feb 26, 2015 at 03:13 AM
I solved this problem. I was not aware that an image had to be placed on a canvas. When I added the canvas to the game object, it worked just fine for me.
If you have the same problem, add a 'canvas' component to your game object. you can then modify the canvas to modify your image.
Your answer
![](https://koobas.hobune.stream/wayback/20220613184325im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Change size of UI canvas image, the best option? 1 Answer
How to enable and disable raw image on ui system 3 Answers
Ring with changeable diameters 1 Answer
UI image with button component not tracking mouse correctly 1 Answer
Setting UI Image Sprite via Script Prevents Color Change from Registering 0 Answers