Unity Editor 自動填入 Keystore 密碼腳本

因為每次開啟專案時先前在 PlayerSettings > Publishing Settings 設定好的 Keystore 密碼都要重新輸入一次很麻煩,所以來寫一個腳本讓他自己填入。

記得腳本要放在 Editor 資料夾下,而且程式碼要一次打對,不然整個 Unity 就要重開了。

using UnityEditor;

[InitializeOnLoad]
public class PreloadSigningAlias {

    static PreloadSigningAlias() {
        PlayerSettings.Android.keystorePass = "KEYSTORE_PASS";
        PlayerSettings.Android.keyaliasName = "KEYALIAS_NAME";
        PlayerSettings.Android.keyaliasPass = "KEYALIAS_PASS";
    }

}

資料來源: https://answers.unity.com/questions/757834/publishing-settings-keystore-password-not-saving.html