Building to the Phone



Building to standalone is super easy. Just compiling takes forever as always.

TacTicToe running as a standalone.

[Player Settings...] can also be used to change things like the favicons and the program title among other useful tidbits. Building to android is obviously a bit more complicated. Luckily it just so happens that there's a handy tutorial on the Unity website. Plus the SDK also helps clear things up.

Unity's Remote 4 is also something to look at.

Since I've never done this before (porting games) I don't really know how this works, so I just installed the SDK and and built the apk file.

Important to note that you need to modify this field when you compile to Android otherwise it doesn't work,

My worry is that I haven't actually done anything in terms of phone code, so I don't know if the Mouse events will still work.




Testing it on an android device shows that it does indeed work, but there is a certain problem. Namely the resolution. Some Googling shows that there is a super handy way of compiling to different platforms. To test it I coded a short context sensitive text change.

void Start()
{
    clickGameEnd = true;
    scoreO = 0;
    scoreX = 0;

#if (UNITY_ANDROID || UNITY_IPHONE)
    GUIGameOver.text = "Touch to restart";
#endif

Running on standalone.

Running on Android - changing text from click to touch.

My ingenious solution to the resolution problem is to move the camera back when the game is running on the phone.

You can also see how the #if comments out code for different platforms.

Then its just a matter of testing it on the phone, which works.

Woo yeah victory for me!
 And that's it for the TacTicToe stuff. I'll probably expand on it at a later date.

No comments:

Post a Comment