Build MajdataPlay
MajdataPlay is a Unity project and must be built with the Unity Editor. The .slnx and .csproj files in the repository root are generated by Unity. You cannot produce a runnable game with dotnet build or the standard .NET build commands in Visual Studio.
Prepare the development environment
Install the following before building:
- Git
- Unity Hub
- The Unity Editor version specified in
ProjectSettings/ProjectVersion.txt - The Unity build support module for your target platform
- .NET 9 SDK (only for generating the Android Java bindings, not for building the Unity project)
The project currently uses Unity 6000.3.17f1. If the project is upgraded, use the version in ProjectSettings/ProjectVersion.txt instead. Install that version from the Installs page in Unity Hub, then use Add modules to install the modules you need.
| Target platform | Required module or tool |
|---|---|
| Windows | Windows Build Support |
| Linux | Linux Build Support |
| macOS | Mac Build Support |
| Android | Android Build Support, including Android SDK & NDK Tools and OpenJDK |
| iOS | iOS Build Support; producing the app also requires macOS and Xcode |
Clone the complete repository
The repository uses Git submodules for some dependencies. Include --recurse-submodules when cloning:
git clone --recurse-submodules https://github.com/LingFeng-bbben/MajdataPlay.git
cd MajdataPlayIf you have already cloned the repository, run:
git submodule sync --recursive
git submodule update --init --recursiveGenerate the Android Java bindings
The Android storage backend uses a locally compiled Java wrapper DLL. Before importing the project into Unity for the first time, run this from the repository root:
dotnet run --project Tools/CSharp/AndroidJavaWrapperGenerator/AndroidJavaWrapperGenerator.csproj -- --project . --unity-data "C:/Program Files/Unity Editors/6000.3.17f1/Editor/Data" --no-docsPoint --unity-data at the Editor/Data directory of the Unity Editor in use; if the Android SDK is installed separately, pass it with --sdk. The generator writes its sources to Tools/AndroidJavaWrapper/src and installs MajdataPlay.Platform.Android.Runtime.dll into Assets/Plugins/MajdataPlay/Platform/Android after a successful build.
You can also run Tools > MajdataPlay > Android > Regenerate Java wrappers in Unity. See Assets/Plugins/MajdataPlay/Platform/Android/README.md for output ownership, cancellation and setup, and Tools/AndroidJavaWrapper/README.md for partial extensions and rebuilding the DLL without regenerating the Java bindings.
Build in the Unity Editor
- In Unity Hub, select Add > Add project from disk, then select the repository root containing
Assets,Packages, andProjectSettings. - Open the project with the Editor version specified in
ProjectSettings/ProjectVersion.txt. The first time the project opens, wait for Unity to restore packages and import assets. - Open File > Build Profiles.
- Select an existing profile for the target platform, or select Add Build Profile to create one. Then click Switch Profile.
- Keep the configured Scene List, click Build, and save the output outside the repository or in an ignored directory such as
Builds/Windows.
Windows and Linux builds must be distributed with their entire output directory. Do not copy only the executable.
Build for Android
In the Android Build Profile:
- For local installation and testing, leave Build App Bundle (Google Play) off to generate an APK.
- For Google Play releases, turn on Build App Bundle (Google Play) to generate an AAB, and configure your own signing key.
- If local testing produces a keystore error, open Player Settings > Publishing Settings and stop using the project's publishing key, or choose your own keystore. The repository does not include the official publishing key.
Build for iOS
Unity's Build command generates an Xcode project, not an IPA file. On macOS, open the generated Unity-iPhone.xcodeproj in Xcode, select a development team, configure signing, and then build to a device or create an archive.
Build from the command line
MajdataPlay.Editor.CustomBuild provides the same command-line entry point used by continuous integration. To build a Windows release from the repository root, run:
& '<Unity Editor path>\Editor\Unity.exe' `
-batchmode `
-quit `
-projectPath (Get-Location) `
-executeMethod MajdataPlay.Editor.CustomBuild.BuildRelease `
-buildTarget StandaloneWindows64 `
-customBuildPath "$PWD\Builds\Windows\MajdataPlay.exe" `
-customBuildName MajdataPlay `
-logFile -Replace <Unity Editor path> with the installation directory of the required Editor version in Unity Hub. For a development build, replace BuildRelease with BuildDebug. For other platforms, use the appropriate Unity BuildTarget name, such as StandaloneLinux64, StandaloneOSX, Android, or iOS.
Troubleshoot build problems
- If types or namespaces are missing, make sure all Git submodules were initialized recursively, then wait for Unity to finish restoring packages.
- If the target platform is missing from Build Profiles, return to Unity Hub and install the corresponding Build Support module for the current Editor.
- If a command-line build fails, check the Unity log in the terminal. For Editor builds, start with the first error in Window > General > Console.
- Changing Unity versions may rewrite project assets and settings. Use the version specified in
ProjectSettings/ProjectVersion.txtwhile developing.
