Search Unity

Pixel Perfect Camera and UI?

Discussion in '2D' started by Deleted User, Sep 24, 2019.

  1. Deleted User

    Deleted User

    Guest

    Hi
    I want to make a pixel game. I use the unity pixel perfect camera with crop frame.
    So I have the black borders. Now I want to make an UI but i have the problem that the UI orientate on the real image borders and not at the black borders. How can I make an UI that works together with the pixel perfect camera?
     
  2. Luto_Akino

    Luto_Akino

    Joined:
    Feb 20, 2018
    Posts:
    21
    I had the same problem, but threw away the idea of using the canvas for the same reason. So I opted for another solution and now I have my user interface attached to my camera and I detect the buttons pressed with a raycast.
     
  3. RichardKain

    RichardKain

    Joined:
    Oct 1, 2012
    Posts:
    1,261
    Instead of drawing the UI to the screen in the traditional fashion, use a separate camera to draw it to a RenderTexture.
     
  4. Deleted User

    Deleted User

    Guest

    the idea to solve is over render texture is nice.
    But i dont worked with render textures is there somewhere a god tutorial how to do such an ui?
     
  5. Luto_Akino

    Luto_Akino

    Joined:
    Feb 20, 2018
    Posts:
    21
    good idea. but what about performance in mobile devices for example?.... Is using 2 cameras efficient?...
     
  6. Deleted User

    Deleted User

    Guest

    This salution sounds good but how do you solve different resolutions?
     
  7. Luto_Akino

    Luto_Akino

    Joined:
    Feb 20, 2018
    Posts:
    21
    in my case, i let that "2D Pixel Perfect" do the job with the "Crop Frame"and "stretch fill" option enabled.