

Even if it's the only vcam enabled, it's not zooming. I mean, everything else works, the rotation, etc, everything but the zoom. To achieve that, I have added a 3rd "CM vcamZOOM".īut nope, it's not working at all. Now, I need to make a zoom on the player. (note : I'm aware there's another PixelPerfect component in the "2D pixel perfect" package, but it's only compatible with LWRP projects if I'm right.)ĬM vcam1 and CM vcam2 are used to make transitions between Areas. I feel that the right PixelPerfect component because it seems that it's the only one working for my project ahah. So I use the Camera component named "Pixel Perfect Camera (Experimental)". The CM PixelPerfect component doesn't work in my 2D Tilebased game. ZoomOut() - Decrement the zoom scale to the next whole number limited to to 1.There are many PixelPerfect component that exists and it confuses me.ZoomIn() - Increment the zoom scale to the next whole number capped to ZoomScaleMax.SetZoomImmediate(float) - Set the current zoom immediately skipping the smooth transition.SetZoom(float) - Set the current zoom level.SetSmoovZoomDuration(float) - Set the time in seconds it takes the zoom transition to go from the current scale to the next.SetZoomScaleMax(int) - Sets the upper limit of zoom.SetPixelsPerUnit(int) - This should be the same value used for all of the sprites in your scene.Note: Can possibly return a value between transitions instead of whole number depending on if the smooth transition is actively happening. currentZoomScale - Returns the current zoom scale.Control via codeĬache the PerfectPixelWithZoom Object with GetComponent() in your script.Ĭall any of the public properties and methods in your script to adjust the Camera. Select functions (methods) from the PerfectPixelWithZoom list. Link the Camera containing the PerfectPixelWithZoom component.

Control via Button/Toggle triggersīe sure an Event System is in place or the buttons won't work.Īdd an On Click () or On Value Changed (boolean) to the list in the inspector. Advanced Info:Īttach the PerfectPixelWithZoom.cs as a component to the desired Camera. Smoov Zoom Duration - The time in seconds it takes the zoom transition to go from the current scale to the next.Įnter Play mode and scroll the mouse wheel back and forth.Smoov Zoom - Toggle on/off the smooth transition between zoom levels.Zoom Scale Start - Initial zoom scale on Start.Pixels Per Unit - This should be the same value used for all of the sprites in your scene.Go to the Perfect Pixel With Zoom component on the Main Camera and edit the Fields. Link the Main Camera with PerfectPixelWithZoom to the ppwzCamera field in the Zoom.cs component. Click the buttons to demo each of the controls available with the PerfectPixelWithZoom class.Īdd the PerfectPixelWithZoom.cs script to your Main Camera.Īdd the Zoom.cs sample to the Main Camera or another game object.Scroll the mouse wheel when in play mode to zoom in and out.3 Sprite examples will display with pixel densities:.Disable any other scenes and hit the Play button to activate play mode to see it in action. Demo Project:Ĭlone this repository and open the Pixel-Perfect-Camera-With-Zoom-Controls as a project with Unity, then bring the Pixel Perfect Camera With Zoom Controls scene into the Hierarchy. **Note:**The only absolutely required script should be the PerfectPixelWithZoom.cs.
#Cinemachine pixel perfect download#
Optional smooth zooming between zoom levels over a duration.Ĭlone or download this repository to your machine.Ĭopy the Assets/PixelPerfectCameraWithZoomControls folder into your Assets folder.Sets an appropriate scale on the camera based on a desired level of zoom.Automatically adjusts to screen height even after changing the display size.

You can use this to avoid displaying irregularly rectangular pixels. There's a lot of shenanigans when it comes to working with pixel perfect display of sprites in Unity, especially when you're rolling your own perfect pixel solution.
