Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Objects not shown in canvas

Discussion in 'Scripting' started by FalconJ, Mar 24, 2015.

  1. FalconJ

    FalconJ

    Joined:
    Mar 12, 2015
    Posts:
    146
    I added sprite objects into the canvas but when I run it, the object doesn't appear.
    What should I do to make it appear?
     
  2. Sykoo

    Sykoo

    Joined:
    Jul 25, 2014
    Posts:
    1,394
    Are you sure that there are no scripts that disables or makes the sprites invisible?
     
  3. ivyroxy

    ivyroxy

    Joined:
    Mar 23, 2015
    Posts:
    38
    If it's a Sprite, then make sure that the Camera is set on Orthgraphic. Also that the Sprite is in the camera's FOV.
    If it's a texture on a Quad/Plane, make sure it is not rotated around Y axis. Quads and Planes are only visible on one side.

    It's hard to guess without a proper idea of what you did. How about sharing a screenshot?
     
  4. blizzy

    blizzy

    Joined:
    Apr 27, 2014
    Posts:
    775
    Also check the render mode on the canvas, whether it's world space or screen space.
     
  5. FalconJ

    FalconJ

    Joined:
    Mar 12, 2015
    Posts:
    146
    Nevermind, I figured it out. Turns out I should use image instead of sprite renderer.
    Thanks all!
     
  6. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Sprites will still appear. The positioning just gets really weird. I don't recommend it. As you have discovered image is a better way to go.
     
  7. FalconJ

    FalconJ

    Joined:
    Mar 12, 2015
    Posts:
    146
    I just realized, does the OnMouseDown() function not working for images? Because I can't get it to work.
     
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Add a button component instead of an image.

    Or if you need more control use an image and and EventTrigger.

    For ultimate control implement the interfaces from the EventsSystem namespace on your own script.
     
    FalconJ likes this.
  9. FalconJ

    FalconJ

    Joined:
    Mar 12, 2015
    Posts:
    146
    Yeah, using the button did the trick. thank you!