Skip to content
Development
Command

/build-unity

Build Unity project (WebGL, Desktop, or PSG1)

From plugin
solana-ai-kit
10130 skills15 agents30 commands7 MCP
Install
> /plugin marketplace add solanabr/solana-ai-kit
> /plugin install solana-ai-kit@stbr

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/build-unity

Context preview

What this command does when you run it.

Build Unity project (WebGL, Desktop, or PSG1)

Command definition

build-unity.md
description: "Build Unity project (WebGL, Desktop, or PSG1)"

You are building a Unity project for Solana game development. Follow these steps:

Related Skills

  • [solana-game SKILL.md](../skills/ext/solana-game/skill/SKILL.md) - Unity SDK + PlaySolana/PSG1 patterns

Step 1: Identify Project and Target

echo "๐ŸŽฎ Unity Build Process"
echo "====================="

# Check for Unity project
if [ ! -f "ProjectSettings/ProjectVersion.txt" ]; then
    echo "โŒ Not a Unity project (no ProjectSettings/ProjectVersion.txt)"
    exit 1
fi

# Display Unity version
echo "๐Ÿ“‹ Unity Version:"
cat ProjectSettings/ProjectVersion.txt

# Check build targets
echo ""
echo "๐Ÿ“‹ Available Build Targets:"
echo "  - WebGL (default)"
echo "  - StandaloneWindows64"
echo "  - StandaloneOSX"
echo "  - Android (for PSG1/mobile)"

Step 2: Pre-Build Checks

echo "๐Ÿ” Running pre-build checks..."

# Check for Solana.Unity-SDK
if grep -q "com.solana.unity-sdk" Packages/manifest.json 2>/dev/null; then
    echo "โœ… Solana.Unity-SDK found"
else
    echo "โš ๏ธ  Solana.Unity-SDK not found in manifest.json"
fi

# Check for PlaySolana SDK (optional)
if grep -q "com.playsolana" Packages/manifest.json 2>/dev/null; then
    echo "โœ… PlaySolana SDK found - PSG1 target supported"
fi

# Check for compilation errors by refreshing assets
echo "๐Ÿ“ Checking for compilation errors..."

Step 3: Build Commands

WebGL Build (Browser)

echo "๐ŸŒ Building WebGL..."

# Standard WebGL build
unity-editor -quit -batchmode -nographics \
    -projectPath . \
    -buildTarget WebGL \
    -executeMethod BuildScript.BuildWebGL \
    -logFile build.log

# Check result
if [ $? -eq 0 ]; then
    echo "โœ… WebGL build successful!"
    echo "๐Ÿ“ Output: Build/WebGL/"
else
    echo "โŒ Build failed. Check build.log for details"
    tail -50 build.log
fi

Windows Build (Desktop)

echo "๐Ÿ–ฅ๏ธ Building Windows Standalone..."

unity-editor -quit -batchmode -nographics \
    -projectPath . \
    -buildTarget Win64 \
    -executeMethod BuildScript.BuildWindows \
    -logFile build.log

if [ $? -eq 0 ]; then
    echo "โœ… Windows build successful!"
    echo "๐Ÿ“ Output: Build/Windows/"
else
    echo "โŒ Build failed. Check build.log"
    tail -50 build.log
fi

macOS Build (Desktop)

echo "๐ŸŽ Building macOS..."

unity-editor -quit -batchmode -nographics \
    -projectPath . \
    -buildTarget OSXUniversal \
    -executeMethod BuildScript.BuildMacOS \
    -logFile build.log

if [ $? -eq 0 ]; then
    echo "โœ… macOS build successful!"
    echo "๐Ÿ“ Output: Build/macOS/"
else
    echo "โŒ Build failed. Check build.log"
    tail -50 build.log
fi

Android Build (PSG1/Mobile)

echo "๐Ÿ“ฑ Building Android..."

# Note: Requires Android SDK and NDK configured
unity-editor -quit -batchmode -nographics \
    -projectPath . \
    -buildTarget Android \
    -executeMethod BuildScript.BuildAndroid \
    -logFile build.log

if [ $? -eq 0 ]; then
    echo "โœ… Android build successful!"
    echo "๐Ÿ“ Output: Build/Android/"
else
    echo "โŒ Build failed. Check build.log"
    tail -50 build.log
fi

Step 4: Build Script Template

If no build script exists, create one:

// Assets/Editor/BuildScript.cs
using UnityEditor;
using UnityEditor.Build.Reporting;
using UnityEngine;
using System.Linq;

public static class BuildScript
{
    private static readonly string[] Scenes = GetEnabledScenes();

    private static string[] GetEnabledScenes()
    {
        return EditorBuildSettings.scenes
            .Where(s => s.enabled)
            .Select(s => s.path)
            .ToArray();
    }

    [MenuItem("Build/WebGL")]
    public static void BuildWebGL()
    {
        var options = new BuildPlayerOptions
        {
            scenes = Scenes,
            locationPathName = "Build/WebGL",
            target = BuildTarget.WebGL,
            options = BuildOptions.None
        };

        Build(options);
    }

    [MenuItem("Build/Windows")]
    public static void BuildWindows()
    {
        var options = new BuildPlayerOptions
        {
            scenes = Scenes,
            locationPathName = "Build/Windows/Game.exe",
            target = BuildTarget.StandaloneWindows64,
            options = BuildOptions.None
        };

        Build(options);
    }

    [MenuItem("Build/macOS")]
    public static void BuildMacOS()
    {
        var options = new BuildPlayerOptions
        {
            scenes = Scenes,
            locationPathName = "Build/macOS/Game.app",
            target = BuildTarget.StandaloneOSX,
            options = BuildOptions.None
        };

        Build(options);
    }

    [MenuItem("Build/Android")]
    public static void BuildAndroid()
    {
        var options = new BuildPlayerOptions
        {
            scenes = Scenes,
            locationPathName = "Build/Android/Game.apk",
            target = BuildTarget.Android,
            options = BuildOptions.None
        };

        Build(options);
    }

    private static void Build(BuildPlayerOptions options)
    {
        Debug.Log($"Building for {options.target}...");
        Debug.Log($"Scenes: {string.Join(", ", options.scenes)}");

        var report = BuildPipeline.BuildPlayer(options);

        if (report.summary.result == BuildResult.Succeeded)
        {
            Debug.Log($"Build succeeded: {report.summary.totalSize / 1024 / 1024} MB");
            Debug.Log($"Output: {options.locationPathName}");
        }
        else
        {
            Debug.LogError($"Build failed with {report.summary.totalErrors} errors");
            foreach (var step in report.steps)
            {
                foreach (var message in step.messages)
                {
                    if (message.type == LogType.Error)
                    {
                        Debug.LogError(message.content);
                    }
                }
            }
            EditorApplication.Exit(1);
        }
    }
}

Step 5: Post-Build Ve

Read more
Ships withsolana-ai-kit

Production-ready Claude Code configuration for full-stack Solana development. Combines best practices from multiple sources into an agent-optimized, token-efficient config you can install and adapt to your specific project.

Get the whole plugin

Other commands on solana-ai-kit.