Resolution Indepenedent Joystick and GUI

Hi, I am making my 2nd game for Android. I am using Unity 3.5.7f6 to make game for ARMv6 devices also. I know the compatibility issues that I can face too.

My targetted device is an ARMv7 device Micromax canvas A110 in landscape left mode i.e. 854px x 480 px.

I needed Joystick and buttons for this game, so I used the “Standard Assets(Mobile)” package and converted the joystick script to c# with a lot of help from google.

So, I set the pixel inset and everything to make the joystick stand out. And, turns out it works, it really works on an 854px x 480 px Canvas or screen size.

Here’s the output::
[29252-gui+setup.png|29252]

This is how it should look like in 854 px x 480 px size. As per the GDD I made. And, it looks similar to like this on 854 px x 480px canvas.

But, I then tested it on a Samsung Galaxy Y ( ARM v 6 device) with canvas size 320px x 240 px, the result was like this::

29251-sc20140715-203648.png

The joysticks are colliding to each others.

Now, I found that using the “Standard Assets(Mobile)” pack, and using pixel inset is going to cause all this trouble.

Problem is I already have 2 states for movement joystick i.e. up state and down state. Same for the jump button and the select button. One button on the other hand has 3 states as it is an ability: up state, down state, cooldown state.


Now, I looked into the issues. And, came across multiple solutions.

Like::

  1. Resolution Independed GUI Texture
  2. The many Resolutions of Android
  3. Unity GUI Tutorial - Scale GUI to the right size for every resolution
  4. Using NGUI ( Expensive )

But, I just want to tweak the original Standard Assets(Mobile) packs scripts to meet up with my requirements.

So, could you guys help me with making the joysticks resolution independent, cause Pixel Inset is ruining the experience right now.

Also, NGUI is an expensive package to buy, but if it helps I’ll have to get it.

So, do help me on this.

Note: I do not think any scripts are required because it’s not some script issue. It’s an issue with pixel Inset.

Remember, I am building for 854x480 in Unity and tested to see how it looks in 320x240 i.e. it looks horrible only for the GUI other are good.

Edit: I am using Unity 3.5.7f6 so please remember this while answering something like use NGUI because it is for Unity 4.3.4 or above.

You can make the pixel inset dependent on Screen.width and Screen.height. Just divide or multiply (whichever works best) depending on the screen’s size. You can also do this for the size of the joysticks to make them smaller so they’re not taking up so much room.