i want “pixelSize” of light camera. So, i wrote (light camera name).pixelWidth and pixelHeight.
but output is view camera’s, not light camera’s.
//View Camera is Camera.main
//Light Camera is "lightCam"
RenderTexture rt = new Rendertexture(lightCam.GetComponent<Camera>().pixelWidth, lightCam.GetCompoent<Camera>().pixelHeight, 16, RenderTextureFormat.Depth);
but size of rendertexture is Main’s…or it is screen size…
what’s the problem?
using UnityEngine;
using System.Collections;
public class fortest : MonoBehaviour {
public Camera cam1;
public Camera cam2;
void Update (){
print ("cam1 " + cam1.GetComponent<Camera> ().pixelWidth);
print ("cam2 " + cam2.GetComponent<Camera> ().pixelWidth);
}
}
i think pixelSize is Screen’s pixel.
i changed differently their Size. but output is same.
anyone know how to get camera’s pixel size?
i can calculate it by camera size. but it’s very silly. very expensive…