Unity 3D Split APK for Android Google Play – OBB File

When I found myself having to split an android application (APK file) to allow it to be uploaded onto the Google Play store, I found a serious lack of current information and much misdirection possibly due to the recent changes within Unity and the actual Play store itself.

So here is a rough guide that works with unity 4.3 or up, in this example I am only catering for devices running android 4.0 ICS or up ( API level 16), not quite sure what to do with earlier Android API versions at this very moment.

STEP -1

Firstly ignore the asset store OBB plug-in  (it was created for earlier versions of unity, or possibly for catering for earlier Android API’s) going down this route will burn hours of your life.

STEP  1

If you haven’t done so already go to EDIT>PROJECT SETTINGS>PLAYER SETTINGS select the android role out and go to the PUBLISHING SETTINGS roll-out and do the following:-

1) Create a new keystore by selecting a keystore name and password (confirm the password)
2) Select “Create a new key” under Key Alias
3) A new window opens; enter the necessary information.
4) Select the newly created key.

n.b. Remember the passwords; they are not stored with the project (for security reasons), every time you load the project you will need to enter this password from now on.

5) Tick Split Application Binary at the bottom of this roll out!

STEP 2

Again if you haven’t already done so create a primary loading scene with very little content, this will allow unity to split most of your app data off to the OBB data/zip file and keep the APK file size small. As an example I created a scene called Android Loader, so that I could exclude […]

Chroma Key / Key Matte Shader for Textures – Vuforia Video Textures

I was going to place this on the asset store, but someone already has put something on there, so here you go for free, this shader simply removes a set colour with tolerance from a texture and makes its transparent. It is really useful when using video/movie textures with Qualcomm Vuforia plugin to cut out a person for instance on a blue screen /  keyable background to then plant that character in an Augmented Reality setting:

As advised below, this shader should possibly tagged with the keywords IOS, Android, Alpha, Channel. Hope this helps.

Unity3d XML Object/Class/Type Serialisation Attributes

In an earlier post I post the basics of parsing xml to a class/object of type, below are the correct attributes to help the parser with coercion of values, type and values to ignore etc, which helps speed things up dramatically obviously, in this example we take some arbitrary XML as below:-

And in unity for this xml would have the class set with the following xml attributes (note the use of List ‘using system.collections.generic;’ ):-

And to take the xml text and parse it to the object:-

 

 

By |November 17th, 2013|Unity 3D|Comments Off on Unity3d XML Object/Class/Type Serialisation Attributes

Unity3d XML Object/Class Serialisation (the basics)

A friend of mine was asking about how you can save the scene hierarchy and object/script properties  in Unity, he had written most of the code instantiating prefabs and was already busy setting variables via interactions in his scripts. I explained that although I do have a generic reflection based method, that can save/restore the hierarchy, gameobjects, transforms, materials & script variables ( used on the space application ), it would be too verbose and unfitting for this task, plus if his script and prefab scripts were not written the right way this approach may not work.

With simpler configuration apps a much simpler class based object oriented approach is all that is required and most cases it is better to start with that system in mind than to retro fit. It is also much better if bringing in xml /json from other sources to reflect the xml/json structure with a c# class which you can then attach methods to manipulate the data, rather than hand parse each node (after learning the hard way), something that might be appropriate with collada objects perhaps.

Update: The methods below how to correctly set xml attributes in c# to coerce your values from the xml to your class see the latest post:-

Unity3d XML Object/Class/Type Serialisation Attributes

Below is an older very simple one script demonstration of instantiation and recording values to and from XML in Unity, apologies for any errors or messy logic I think I only had an hour to write it one afternoon, but hopefully it will convey the basics, but I would use the above attributes in c# see the link above over the method below for helping the xml parser […]

By |September 2nd, 2013|CodeBlog, Unity 3D|Comments Off on Unity3d XML Object/Class Serialisation (the basics)

Unity 3D – Add A Short Cut To Desktop C# – Hack Method

Having to create a short cut to the desktop for an app seems easy if you do it manually, most of the programmatic ways I have so far found on the internet involve referring to a COM Library/Component to facilitate this, any how here is a slightly hacky version that seems to work for me found on a forum which I have adapted to take data from unity etc

Warning! This method relies upon writing and executing a visual basic script to create the short cut, security measures on some machines may not allow this so be warned.

 

By |August 28th, 2013|Unity 3D|Comments Off on Unity 3D – Add A Short Cut To Desktop C# – Hack Method