1
Support / Dynamically set tk2dCamera resolutionOverride in code
« on: November 24, 2012, 06:16:28 pm »
I haven't updated 2D Toolkit in a while, and I recently decided to update to 1.80 patch 3. I noticed that camera scaling (resolution override) seems to work quite differently now.
I used to handle camera scaling dynamically in code, and that worked really well for me, but my old script doesn't work anymore. This is the script that I used to put on my tk2dCamera object, in the Start() method:
I'm not interested in using 2D Toolkit's new automatic scaling ? it doesn't allow me to fine tune my scaling enough, and I want pixel perfect scaling that's always a factor of 2 ? but, again, my old script isn't working anymore.
How can I manually set the resolutionOverride scale value with this new version of 2D Toolkit?
I used to handle camera scaling dynamically in code, and that worked really well for me, but my old script doesn't work anymore. This is the script that I used to put on my tk2dCamera object, in the Start() method:
Code: [Select]
tk2dCamera.inst.resolutionOverride = new tk2dCameraResolutionOverride[1];
tk2dCamera.inst.resolutionOverride[0] = new tk2dCameraResolutionOverride();
tk2dCamera.inst.resolutionOverride[0].width = Screen.width;
tk2dCamera.inst.resolutionOverride[0].height = Screen.height;
if (Screen.height >= 1280)
tk2dCamera.inst.resolutionOverride[0].scale = 4f;
else if (Screen.height >= 640)
tk2dCamera.inst.resolutionOverride[0].scale = 2f;
else
tk2dCamera.inst.resolutionOverride[0].scale = 1f;
tk2dCamera.inst.UpdateCameraMatrix();
I'm not interested in using 2D Toolkit's new automatic scaling ? it doesn't allow me to fine tune my scaling enough, and I want pixel perfect scaling that's always a factor of 2 ? but, again, my old script isn't working anymore.
How can I manually set the resolutionOverride scale value with this new version of 2D Toolkit?