- Home /
UI joystick changes place after screen orientation
hello,
I'm trying to put a simple joystick in my scene using the joystick script and it's all working fine in the editor. In build however, the joystick moves close to the center of the screen after i touch it. It happens only when i orientate the screen and even in editor it's an issue if i change the screen size before touching the joystick.
The game is set up in an android environment. I'm using the default joystick script that comes in the "cross platform input" package. The screen is oriented by this code:
void Awake ()
{
Screen.orientation = ScreenOrientation.Landscape;
}
Any advice would be really appreciated!!!
Answer by JBarronUPMH · Nov 30, 2019 at 06:47 PM
@Yamf . I just helped some students with this issue. The problem was that the joystick takes the screen width of the portrait orientation, even if it's on landscape. Not even changing the orientation before loading the scene helped.
We solved it by setting Landscape Right for the whole application in the player settings and changing it from code to Portrait in every other scene (We didn't need to change orientations once in the scene).
It's really disapointing that after 3 years this is still an issue.
Your answer
![](https://koobas.hobune.stream/wayback/20220612092527im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
OnDrag OnPointerDown OnPointerUp does not work 1 Answer
Problem on new InputSystem touch(UI) 1 Answer
RawImage with correct aspect ratio 2 Answers
Menu Transitions on Android 0 Answers
UI Navigation with gamepad 7 Answers