Hello Guest

Author Topic: Pixel.rect not working with 2dTK Camera  (Read 3297 times)

gibberlinginvasion

  • Newbie
  • *
  • Posts: 1
    • View Profile
Pixel.rect not working with 2dTK Camera
« on: November 04, 2014, 10:29:24 pm »
Prior to using a 2dTK Camera I was using Camera.Pixelrect to set up an exact pixel height/width and letterboxing, and I'd like to be able to do this with the 2DTK Camera but can't figure out how. For the camera I don't care about aspect ratio, I'm needing exact pixels, hence the pixelrect.

Any help or alternatives would be greatly appreciated — I don't think there are any script references in the 2DTK Camera scripts for pixelrect.

Thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Pixel.rect not working with 2dTK Camera
« Reply #1 on: November 05, 2014, 11:56:06 am »
There isn't an equivalent - you can work out the rect you need based on Screen.width / height and assign it to tk2dCamera.CameraSettings.rect. Any form of camera.rect viewport adjustment turns into an unholy mess when you deal with automatic adjustment. We don't intend on supporting that as it would add significant complexity.

It might be worth using a normal unity camera for this, or just ignore letterboxing the camera and add 2 solid black objects right in front of the camera to deal with the letterboxing. Solid = draws first and writes to depth, so not massive cost. IMO - its much easier to manage the 2 objects than mess about with the camera there.