Automatic Android Code Signing in Unity

Create a new folder in your project called Editor
Within that folder create a new C# script called something like PreloadSigningAlias.cs
Copy and paste the code below into the script and save it.
Replace KEYSTORE_PASS with the password to your keystore
Replace ALIAS_NAME with the name of your android alias
Replace ALIAS_PASSWORD with the password for your alias.
Save again.
Build project.
Done.
 NOTE: I recently changed from a windows laptop to a macbook and had to set this up again. During that process I discovered I couldn’t select the .jks key store file I had created with android. To fix this I had to rename the file so it had a .keystore extension. 

using UnityEngine;
using UnityEditor;
using System.IO;
[InitializeOnLoad]
public class PreloadSigningAlias
{
 static PreloadSigningAlias ()
 {
  PlayerSettings.Android.keystorePass = "KEYSTORE_PASS";
  PlayerSettings.Android.keyaliasName = "ALIAS_NAME";
  PlayerSettings.Android.keyaliasPass = "ALIAS_PASSWORD";
 }
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s