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";
 }
}

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *