1
votes

I'm currently creating a 2D Android and iOS game using Unity3D engine. I'm testing the game on a nexus 5, and an iPhone 5s device. Everything until now is working fine and I am pretty happy with the result, but when I test that application on an iPad or a Samsung tablet all the objects in my game scene are not in the correct position anymore. Is this a common problem in Unity3D ?

I know I am missing something but I tried to do some research and what I found is only by changing the orthographic camera scale might fix this problem, but I found it as a big amount of code to write as my game have not only one scene but multiple scenes and every scene have it's own game objects.

Is there any other method to do, a good and simple work around for this problem?

3
Which version Unity3D you use?Barış Çırıka

3 Answers

1
votes

It's all about setting the Anchors right. If you're using the new UI System, make sure you anchor the objects where you want them to be, that's how you will achieve resolution independence.

For more information about anchoring, see this tutorial

1
votes

Don't have separate scenes for separate devices. You can use the Screen object to check the height and width of your display. Then you can use this to set the orthographic size of your camera to something that makes everything visible as expected.

0
votes

Update: I misunderstood your question, you say GameObject, i understand UI.

Please check this. I don't have this issue on my game. But when i try it with mac or windows machines, it is problematic. So maybe this can solve. Other solution is more common which is you and Agumander say, change orthographic size of Camera.

This Is for UI

You can use Unity UI, and don't need to seperate. There are so many different resolution and density devices, you need to create so many scenes. So it is meanless separating scenes.

Unity UI has pixel based solutions which can be very helpfull for many density and resolution options. Forexample, It has VerticalLayoutGroup and HorizontalLayoutGroup for easy list like element visulation.

Most important thing is: Do you want to change UI for different screen size or resolutions? For example iPad has larger screen so user can be see more content. This change UX. Maybe you need to consider this.