|
Post by itjunkii on Jan 25, 2022 23:04:48 GMT
Hello,
When I use both extensions the zoom feature of pan and zoom stops working.
I am trying to do a top down game similar to Clash of Clans on mobile platforms.
Any advice or help would be much appreciated!
|
|
|
Post by Luís Pedro Fonseca on Jan 25, 2022 23:33:07 GMT
itjunkii The reason for that is that the ContentFitter extension forces a specific camera size, while the PanAndZoom extension tries to change it. If you want to limit the camera size look into the NumericBoundaries extension which should work fine with the PanAndZoom.
|
|
|
Post by itjunkii on Jan 26, 2022 4:06:57 GMT
Thanks for the reply! Is there another good solution for managing all the various screen sizes on mobile / tablets other than the content fitter?
|
|
|
Post by itjunkii on Jan 26, 2022 15:09:57 GMT
I suppose I only need the content fitting to happen once per scene load - odd thing is when I disable the content fitter component after initial load the PZ still doesn't work as expected Luís Pedro Fonseca
|
|
|
Post by itjunkii on Jan 26, 2022 16:51:25 GMT
In case its helpful I added this script to my camera to resize the ortho based on the width of the sprite which is my gameplay surface:
public SpriteRenderer map; private void Start () { if (map == null) return; if (Camera.main is { }) Camera.main.orthographicSize = map.bounds.size.x * Screen.height / Screen.width * 0.5f; }
Then I was able to use pc2 + pan and zoom + numeric boundaries to achieve the exact effect I was going for.
Thanks for the help!!
|
|
|
Post by Luís Pedro Fonseca on Jan 27, 2022 22:01:35 GMT
itjunkii Glad to see that worked for you. Let me know if you need further help
|
|