0
\$\begingroup\$

On the Google Play Console, you can't have two games with the same package name.

Is there a way to have two of the same game with different package names, exported from the same Unity project? For example, a "lite version" with ads and a "full version" without ads.

\$\endgroup\$
1
  • \$\begingroup\$ Have you tried changing the "Package name" in the Unity project settings? \$\endgroup\$
    – Kevin
    Jan 25, 2021 at 23:54

1 Answer 1

1
\$\begingroup\$

To change the Package Name for an Android project, go to Edit > Project Settings > Player > Other Settings and change the "Package Name". See https://docs.unity3d.com/Manual/class-PlayerSettingsAndroid.html#Other

If you want to partially automate this, you can use Editor scripts, e.g:

[MenuItem("MyGame/Switch to Full version" )]
private static void FullVersion() {
    //I am not 100% certain that "applicationIdentifier" is the correct property, but I think it is.
    PlayerSettings.applicationIdentifier = "com.mycompany.mygame";
    PlayerSettings.productName = "My Game";
    PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "FULL_VERSION");
}

[MenuItem("MyGame/Switch to Lite version" )]
private static void LiteVersion() {
    PlayerSettings.applicationIdentifier = "com.mycompany.mygamelite";
    PlayerSettings.productName = "My Game Lite";
    PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "LITE_VERSION");
}

Depending on your game structure, you may also need to change which scenes are included in your build. I won't get into that here.

The scripting define symbols let you add conditional compilation to your code, e.g.

public class MainMenu : MonoBehaviour {
    void Start() {
#if LITE_VERSION
        LoadAds();
#elif FULL_VERSION
        CheckDailyRewards();
#endif
    }

#if LITE_VERSION
    void LoadAds() {
        //load ads here
    }
#endif

#if FULL_VERSION
    void CheckDailyRewards() {
        //check rewards here
    }
#endif
}
```
\$\endgroup\$
7
  • \$\begingroup\$ so keep the unity project the same but i can change the package name depending on lite and full version and google play wouldn't notice it as a duplicate but it own original package name. \$\endgroup\$
    – MM1Content
    Jan 26, 2021 at 1:52
  • \$\begingroup\$ Yes, if you change the package name (either in the project settings menu, or from an Editor script) and make a build, it will use that package name in the build and that is the package name that Google Play will see. \$\endgroup\$
    – Kevin
    Jan 26, 2021 at 2:07
  • \$\begingroup\$ awh nice! thanks for clarifying :) \$\endgroup\$
    – MM1Content
    Jan 26, 2021 at 2:17
  • \$\begingroup\$ @MM1Content Glad to help. Please remember to mark this as the correct answer if it answers your question. \$\endgroup\$
    – Kevin
    Jan 26, 2021 at 19:27
  • \$\begingroup\$ Wouldn't Unity consider it as only one project even though I can make two package names? Because on Unity cloud save it shows only one project. \$\endgroup\$
    – MM1Content
    Feb 1, 2021 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .