Sorry to bother you again, but I couldn’t find the same question in the log, so please ask about Zoom2D().
I tried to use Zoom2D(), but the screen slided and went out.
I uploaded the capture as limited access on Youtube, so please watch it as a reference.
I tried the three subject words : speaker / listener / original.
Then, it was not sliding when I use speaker or listener, but zooming was not working.
My main camera setting is here:
MainCamera.png (155.03 KiB) Viewed 716 times
Could you tell me what I should do?
Re: Why the screen is sliding using "Zoom2D" ?
Posted: Fri Apr 30, 2021 10:19 am
by Tony Li
Hi,
Check the position of the Guide GameObject. Zoom2D will move the camera's X and Y coordinates to match Guide's X and Y coordinates.
Also investigate the 3 NullReferenceException errors in the Console window. They may be related.,
Re: Why the screen is sliding using "Zoom2D" ?
Posted: Sat May 01, 2021 11:17 pm
by misaki_e
Thank you for your confirming, Tony.
I'm sorry the NullReferenceException errors confused you, but it seems completely not related.
Here is the video that I tried when there is no error.
I also tried with the example project.
Zoom2D() does not seems to be working... or, Zoom2D() can't zoom to Spine object?
I would appreciate it if you could give me some advice.
Re: Why the screen is sliding using "Zoom2D" ?
Posted: Sun May 02, 2021 9:12 am
by Tony Li
Hi,
Zoom2D() moves the camera in the scene. The camera draws what is in the scene.
However, you're using a dialogue UI on a screen space canvas, which is the default canvas type. Unity draws screen space canvases on top of the scene, after the camera has drawn what is in the scene.
If you want to zoom to different characters, make them Spine GameObjects in the scene, not part of your dialogue UI canvas.
Re: Why the screen is sliding using "Zoom2D" ?
Posted: Mon May 03, 2021 4:33 am
by misaki_e
Umm, I think I didn’t put the Spine character on Canvas, because I confirmed the game screen was changed when I changed the Main Camera’s size like the following video:
Is there anything else I should check?
Re: Why the screen is sliding using "Zoom2D" ?
Posted: Mon May 03, 2021 9:07 am
by Tony Li
The example scene uses characters on the Canvas, so Zoom2D will not affect them.
Your character is in world space in the scene, so that's good. We just need to understand why the camera is moving away from the character.
Does the scene have more than one GameObject named "Guide"?
What is the position of "Guide"? Inspect the GameObject, and please let me know the Transform > Position > X, Y values.
Keep an Inspector view on the camera when it starts to move like this:
zoom2Dissue.png (192.08 KiB) Viewed 701 times
Does the camera's Transform > Position move to the same X, Y values as Guide?
Re: Why the screen is sliding using "Zoom2D" ?
Posted: Mon May 03, 2021 9:13 pm
by misaki_e
Thank you for your answer, and I finally understand the cause!
Actually, the position of “Guide” was at X 333, Y 333, and the child object(Spine skeleton) was at X-333, Y-333, so the Main Camera moved away.
I’m sorry I didn’t notice it when you gave me the first advice.