Bengkel 4 bring your unity game to windows phone 8

20
BRING YOUR UNITY GAME TO WINDOWS PHONE 8 Gathot Fajar – Creacle Studio Bengkel Gamelan 17/04/2014

Transcript of Bengkel 4 bring your unity game to windows phone 8

Page 1: Bengkel 4 bring your unity game to windows phone 8

BRING YOUR UNITY GAME TO WINDOWS PHONE 8Gathot Fajar – Creacle Studio

Bengkel Gamelan 17/04/2014

Page 2: Bengkel 4 bring your unity game to windows phone 8

[]

Bengkel Gamelan 17/04/2014

Page 3: Bengkel 4 bring your unity game to windows phone 8

Requirements• Unity 4.3• Windows Phone SDK 8.0• Windows 8 or later• For Mac User• Boot Camp, VMWare, Parallels, etc

• Windows 8.1 & VS2013 (if you target WinRT)• Microsoft Account• WP Dev Account

Bengkel Gamelan 17/04/2014

Page 4: Bengkel 4 bring your unity game to windows phone 8

Porting Overview#IF UNITY_WP8#IF UNITY_WINRT

Bengkel Gamelan 17/04/2014

Page 5: Bengkel 4 bring your unity game to windows phone 8

Common Tasks• Orientation Support• Live Tile• Writing Platform Specific Code• Share Task, Share Media Task• Rate & Review • Graphics Issues• Pausing and Resuming your Game• Back Button Support• Fast App Resume

Bengkel Gamelan 17/04/2014

Page 6: Bengkel 4 bring your unity game to windows phone 8

Live Tiles

Bengkel Gamelan 17/04/2014

Page 7: Bengkel 4 bring your unity game to windows phone 8

Live Tiles

Bengkel Gamelan 17/04/2014

Page 8: Bengkel 4 bring your unity game to windows phone 8

Flip Tile

Bengkel Gamelan 17/04/2014

Page 9: Bengkel 4 bring your unity game to windows phone 8

Cycle Tile

Bengkel Gamelan 17/04/2014

Page 10: Bengkel 4 bring your unity game to windows phone 8

Iconic Tile

Bengkel Gamelan 17/04/2014

Page 11: Bengkel 4 bring your unity game to windows phone 8

Live Tile (Basic code)

Bengkel Gamelan 17/04/2014

ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault(); if (tile != null) { FlipTileData flipTile = new FlipTileData();

flipTile.Title = "Mad Race"; flipTile.BackTitle = "Best Score";

flipTile.BackContent = content; flipTile.BackgroundImage = new Uri("/ikon.png", UriKind.Relative); flipTile.BackBackgroundImage = new Uri("/ikonBack.png", UriKind.Relative);

tile.Update(flipTile); }

Page 12: Bengkel 4 bring your unity game to windows phone 8

Create Your Own Plugin• Create New VS Solution• Other Project Types -> Visual Studio Solutions -> Blank

Solution

• Create 2 new projects• Real Project (for Windows Phone) : Windows Phone Class

Library .Net 4.5• Fake Project (for Editor) : Windows -> Class Library .Net 3.5

• Change Assembly Name & Namespace to solution name

Bengkel Gamelan 17/04/2014

Page 13: Bengkel 4 bring your unity game to windows phone 8

Pause & ResumeAction WP Event Unity Event What

happened

User taps tile to launch your game

Activated (with e.IsApplicationInstance Preserved to false)

Awake () Start()

Start your game. Begin fresh (not resuming).

User taps the Windows button to switch to another app

Deactivated OnApplicationPause(true)

Save any state that needs to persist across sessions. No network calls, no CPU cycles.

Bengkel Gamelan 17/04/2014

Page 14: Bengkel 4 bring your unity game to windows phone 8

Pause & Resume (cont.)Action WP Event Unity Event What happened

User comes back to the game (via task manager or back button)

Activated (with e.IsApplicaTion Instance Preserved to true)

OnApplicationPause(false)

Resume the game. You get all the resources back.

Phone rings Obscured OnApplicationPause(true)

Pause your game. Networking won’t be cancelled, your game still has CPU cycles. You are in memory and active.

Bengkel Gamelan 17/04/2014

Page 15: Bengkel 4 bring your unity game to windows phone 8

Pause & Resume (cont.)Action WP Event Unity Event What

happened

The notification UI goes away, user dismisses it

Unobscured OnApplicationPause(false)

Resume your game.

User clicks the back button at the root of your game and app exits

Closing OnApplicationQuit

Save state and exit your game.

Bengkel Gamelan 17/04/2014

Page 16: Bengkel 4 bring your unity game to windows phone 8

Handling the Back Buttonif (Input.GetKey(KeyCode.Escape)){

Application.Quit();}

Bengkel Gamelan 17/04/2014

Page 17: Bengkel 4 bring your unity game to windows phone 8

Fast App Resume• /Properties/WMAppManifest.xml

Bengkel Gamelan 17/04/2014

Page 18: Bengkel 4 bring your unity game to windows phone 8

3rd Party Library

•Telerik•Coding4Fun

Bengkel Gamelan 17/04/2014

Page 20: Bengkel 4 bring your unity game to windows phone 8

THANK YOU#[email protected]

Bengkel Gamelan 17/04/2014