1
\$\begingroup\$

When I start my game on Android my virtual joysticks stops being round.

Here you can see it:

enter image description here

Here is the project on PC at the same time:

enter image description here

Here are my UI settings for the Joystick:

enter image description here

enter image description here

enter image description here

Please, help me to find a way to preserve the roundness on the Android phone. It feels to me that the solution to the problem is straightforward, but my lack of knowledge prevent me from getting it. What I tried to do is to tweak settings in Editor, in particular I checked preserve ratio on all elements images as you can see on screenshots, but it did not help. I think it did not due to the fact that there is a code executed every time which is this:

Screen.orientation = ScreenOrientation.LandscapeLeft;

And I think that it changes ratio even though I preserved it in Editor. So, help me out of the problem, please.

\$\endgroup\$
7
  • \$\begingroup\$ Why is Screen.orientation = ScreenOrientation.LandscapeLeft; executed every time? If you don't know if it's causing the bug, disable it and check if it solves the problem. \$\endgroup\$
    – Jacob
    Jun 18, 2017 at 17:46
  • \$\begingroup\$ Your problem has nothing to do with your joystick. EVERYTHING in your scene is getting squashed. s12.postimg.org/sofff4ycd/squash.png \$\endgroup\$ Jun 18, 2017 at 17:59
  • \$\begingroup\$ issuetracker.unity3d.com/issues/… \$\endgroup\$
    – Jacob
    Jun 18, 2017 at 18:37
  • \$\begingroup\$ @Spectre, I do not understand the solution provided by you. Sorry. \$\endgroup\$
    – Yaroslav
    Jun 18, 2017 at 19:47
  • \$\begingroup\$ Why do you use the Screen.orientation? \$\endgroup\$
    – Jacob
    Jun 18, 2017 at 19:52

1 Answer 1

1
\$\begingroup\$

If you want to specify game orientation, go to File -> Build Settings -> Player Settings and there open a tab Resolution and Presentation.

Set your desired orientation there:

enter image description here

And delete that line: ScreenOrientation.something from your code. I'm 99% sure that it causes all the stretching.

\$\endgroup\$
8
  • \$\begingroup\$ Thanks for the attention. Hope it will help. I have no opportunity to check it right now, but I will do it tomorrow. \$\endgroup\$
    – Yaroslav
    Jun 18, 2017 at 20:10
  • \$\begingroup\$ If it does not, feel free to write here, I'll try to help :) ps. but it will work ;v \$\endgroup\$
    – Jacob
    Jun 18, 2017 at 20:10
  • \$\begingroup\$ Your solution does not work as I want. It has the same effect as before. Everything is squeezed just the same way. \$\endgroup\$
    – Yaroslav
    Jun 19, 2017 at 7:30
  • \$\begingroup\$ Export your project and upload it somewhere so I can download it. Go to Assets -> Export Package and upload the .unityPackage to some dropbox so I can download it. \$\endgroup\$
    – Jacob
    Jun 19, 2017 at 7:35
  • \$\begingroup\$ Wait a moment. I will be right back. \$\endgroup\$
    – Yaroslav
    Jun 19, 2017 at 7:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .