JEngine Documentation

website·Indexed 30 days ago

https://jengine.xgamedev.net/

Documentation for JEngine, including versions v0.7 through v1.1. Covers initial setup, HybridCLR installation, package management, and core components such as JAction for asynchronous execution, MessageBox, JObjectPool, and the Runtime Panel. Includes guides on hot update resource building, packaging, and deployment via the Editor Panel, as well as the Claude Code Plugin in v1.1.

Tokens
20.2K
Snippets
78
Records
163
Agent score
49%

What's inside JEngine

  1. Understand JEngine Package Types

    JEngine supports two types of resource packages for hot updates:

    1. Main Package: Contains core resources and hot update code. It must be loaded first. The default name is main. In YooAsset, if no sub-package is specified, the main package is used by default.
    2. Sub Packages: Used for additional resources (e.g., AddOn1, Raw). These are loaded on demand and can be updated independently of the main package.
  2. Manage JEngine hot update package types

    JEngine supports two types of resource packages for hot updates:

    1. Main Package: Contains core resources and hot update code. It must be loaded first. The default name is main. This is the default package used by YooAsset functions when no sub-package is specified.
    2. Sub Packages: Contain additional resources (e.g., AddOn1, Raw). These are loaded on demand and can be updated independently.
  3. Manage Hot Update Code Dependencies

    Hot update code has strict dependency restrictions: it cannot use code from the Unity project unless that code is a Plugin, Package, DLL, or defined via an Assembly Definition (asmdef). Code within the default Assembly-CSharp project is inaccessible to the hot update project.

    To use main project code in a hot update project:

    1. Separate the main project code into its own project using an .asmdef file.
    2. Add a reference to that main project's asmdef in HotUpdate/Code/HotUpdate.Code.asmdef.
  4. Upgrade JEngine from v1.0.x to v1.1

    Upgrading from v1.0.x to v1.1 involves updating the core package, installing a new UI package, and updating the MessageBox namespace and initialization logic.
    # 1. Update Core Package (Delete Packages/com.jasonxudeveloper.jengine.core first)
    openupm add com.jasonxudeveloper.jengine.core
    
    # 2. Install the New UI Package (MessageBox has moved here)
    openupm add com.jasonxudeveloper.jengine.ui
    
    # 3. Optional: Update Util Package for JAction parallel execution support
    openupm add com.jasonxudeveloper.jengine.util
  5. Best practices for using MessageBox

    1. Asynchronous Handling: Always use async/await with MessageBox.Show. Avoid using .GetAwaiter().GetResult() as it can block the main thread and cause lag.
    2. Performance: The system uses internal object pooling; do not manually manage the lifecycle of the dialog instances.
    3. UI Constraints: MessageBox is modal and prevents interaction with other UI elements while displayed. Visual styles are controlled via Unity UI prefabs.
    4. Dependencies: Ensure UniTask is properly configured in your project as the MessageBox system relies on it.
    // Recommended approach
    public async void HandleUserChoice()
    {
        bool result = await MessageBox.Show("Confirm", "Continue operation?");
        if (result) { /* Handle confirmation */ }
    }
  6. Show asynchronous dialogs with MessageBox

    The MessageBox system (located in the JEngine.UI namespace) allows for showing confirmation dialogs that return a boolean result asynchronously. It supports custom titles, messages, and button labels.
    using JEngine.UI;
    
    // Basic confirmation dialog
    bool result = await MessageBox.Show("Confirm", "Do you want to delete this file?");
    
    // Dialog with custom button text (Confirm, Cancel)
    bool resultCustom = await MessageBox.Show("Save", "Save current changes?", "Save", "Discard");