3. Porting recommendations
1. Prepare your game for x-platform
2. Port your logic
3. Port or replace your plugins
4. Platform specific optimizations
& configuration
5. Implement Light-up
6. Optimize performance
7. .NET CLR (Desktop)
Mono and.NET Core differences…
Mono is a subset of .NET Framework
Mono
.NET Core
Trouble!!
These classes exist in
Mono but are not available to
Unity in Windows Store
and Phone!!
.NET Core is a subset of .NET Framework
8. What is missing?
Namespace Example classes Workaround
System.Collections Hashtable, ArrayList, List Use WinRTLegacy (from Unity)
System.IO File, StreamReader, TextReader Write using Windows.Storage
System.Xml XmlDocument, XmlElement Use WinRTLegacy for basic coverage
System.Reflection Write using equivalent WinRT APIs
System.Security.Cryptography SHA1, TripleDES Use WinRTLegacy for basic coverage
System.Net Socket, NetworkStream Use WinRT networking APIs
System.Threading Thread WinRT is async, use Task, use
coroutines
System.Runtime.Serialisation BinaryWriter No direct binary support. Use
alternate methods
9. Conditional Compilation on Windows/Universal
Use .NET Core (default)
C# compiled using MS Compiler
Can call Windows Runtime APIs from inline scripts
C# types are not visible to JS classes
.NET Core partially
C# scripts in ( Plugins || Standard Assets) use Mono Compiler, can’t
reference Windows Run-time
C# types compiled w/ Mono are visible to JS scripts
None
Uses Mono compiler for everything, no inline calls to WinRT types
11. Capabilities (Windows Phone)
Developers must declare
hardware or software capabilities
in the app’s manifest
Users get presented the required
capabilities upon install
12. Capabilities (Windows)
Developers must declare
hardware or software
capabilities in the app’s
manifest
Users get presented the
required capabilities upon
install
14. Back button ( Windows Phone )
Windows Phone:
App pops the back stack or dismisses modal UI if back button is pressed
App exits when back button is pressed from ‘home’ page and no modal
UI is visible
Unity
Handles back button (natively) and maps it to KeyCode.Escape
Exits the app if back button pressed and Application.Quit is called ( )
15. Back button
//Unity does this for you automatically
<phone:PhoneApplicationPage
BackKeyPress="PhoneApplicationPage_BackKeyPress" >
private void PhoneApplicationPage_BackKeyPress(object sender, CancelEventArgs e)
{
e.Cancel = UnityApp.BackButtonPressed();
}
//IN your unity code, handle back button, you should quit, go back or dismiss modal UI
void Update {
if (Input.GetKeyDown(KeyCode.Escape)){
Application.Quit();
}
}
16. Keyboard (Phone & Windows, Unity 4.5+ )
Seamless keyboard support via GUI
Programmatic access via TouchScreenKeyboard class
On Windows, set keyboard.area is not supported
Setting keyboard.active after instantiate is not required anymore
17. Memory (Windows Phone)
Memory Limits
http://msdn.microsoft.com/en-us/library/windows/apps/jj681682(v=vs.105).aspx
App type 512 MB 1-GB phones 2-GB phones
Windows Phone 8.0 180 MB 380 MB 780 MB
Silverlight 8.1 and
Windows Runtime 8.1
185 MB 390 MB 825 MB
App type Platform
ID_FUNCCAP_EXTEND_MEM Gets you the 180 MB and 380MB WP8
ID_REQ_MEMORY_300 Opts out of lower memory devices WP8
minDeviceMemory Appx similar for ID_REQ_MEMORY WP81, Appx
Manifest settings
18. Memory Tips (Windows Phone)
Test on low-end devices
Use the Unity profiler
Compress textures to DXT1 or DXT5
Reduce Audio Memory Usage
‘Stream from disc’ instead of ‘Compressed in memory’
20. Asset bundles
Can’t be explicitly downloaded
Useful to support multiple resolutions
Useful to chunk features (e.g. tutorial)
21. Audio ( Phone)
If you hear “crackles” on debug builds, try master
Test on devices, emulator will not be representative
To maximize memory, stream from disk
Look at media codecs for Windows Phone
http://msdn.microsoft.com/en-
us/library/windows/apps/ff462087(v=vs.105).aspx
23. Summary
Different run-times
Editor is Mono
Device is .NET
A fairly typical hardware port
Pay attention to
Memory on Windows Phone 8
Back button
Input on Windows