Skip to content
QiuHanWen edited this page Mar 22, 2024 · 2 revisions

You can write you own code just like other unity project.

Access to Manager Instance

You can access different kind of manager instance via AC_ManagerHolder:

public static class AC_ManagerHolder
{
    //——System——
    public static IAC_SystemCursorManager SystemCursorManager { get; internal set; }
    public static IAC_SystemInputManager SystemInputManager { get; internal set; }
    public static IAC_SystemAudioManager SystemAudioManager { get; internal set; }
    public static IAC_SystemLogManager SystemLogManager { get; internal set; }

    //——Setting——
    public static IAC_CommonSettingManager CommonSettingManager { get; internal set; }

    //——Cursor——
    public static IAC_SceneManager SceneManager { get; internal set; }
    public static IAC_EnvironmentManager EnvironmentManager { get; internal set; }
    public static IAC_TransformManager TransformManager { get; internal set; }
    public static IAC_StateManager StateManager { get; internal set; }
}

Interfaces

You can receive callback by inheric from the following interfaces:

  • IAC_Manager_ModInitHandler: Called when mod scene inited/deinited.
  • IAC_CursorState_ChangedHandler: Called when cursor state changed.
  • IAC_CommonSetting_XXXHandler: Called when cursor setting changed.
  • IAC_SystemAudio_XXXDataChangedHandler: Called when system audio data changed.
  • IAC_SystemCursor_AppearanceChangedHandler: Called when system cursor's appeanance changed (eg: activation state/cursor type).
  • IAC_SystemInput_MouseXXXHandler: Called when system mouse input event occured.
  • IAC_SystemWindow_ChangedHandler: Called when active system display's state changed(eg: resolution changed or display changed).

Restrictions

For security reasons, some scripts are not allow to included in mods:

Assembly

  • UnityEditor
  • Mono.Cecil

Namespace

  • System.IO.*
  • UnityEngine.SceneManagement.*

Type

  • System.AppDomain
  • System.Threading.Process
  • UnityEngine.Input
  • Threeyes.IO.FileIO
  • Threeyes.External.ExternalResources
  • PathTool

Member

  • UnityEngine.Application.Quit

Note

  • Custom script inherit from ScriptableObject is not supported, any references to these objects will resolve to null after built.
  • You can check out my AliveCursor_ModUploader sample project for better understanding.

——————

Writing Your Own Code

You can write your own code just like in any other Unity project, using the SDK or other existing plugins.

Accessing Manager Singletons

You can obtain singletons for various managers within the program through the AD_ManagerHolder static class:

public static class AD_ManagerHolder
{
    public static IAD_RuntimeEditorManager RuntimeEditorManager { get; internal set; }

    //——Setting——
    public static IAD_CommonSettingManager CommonSettingManager { get; internal set; }
    public static IAD_InputManager InputManager { get; internal set; }

    //——Mod——
    public static IAD_ModelManager ModelManager { get; internal set; }
    public static IAD_XRManager XRManager { get; internal set; }
    public static IAD_ShellManager ShellManager { get; internal set; }
    public static IAD_DecorationManager DecorationManager { get; internal set; }
    public static IAD_EnvironmentManager EnvironmentManager { get; internal set; }
    public static IAD_PostProcessingManager PostProcessingManager { get; internal set; }
}

Interfaces

By inheriting the following interfaces, you can receive callbacks:

  • IModHandler: Handles mod scene loading/unloading.
  • IHubSystemAudio_XXXDataChangedHandler: Handles changes in system audio data.

Limitations

For security reasons, The following scripts are not allowed to be included in mods:

Assembly:

  • UnityEditor
  • Mono.Cecil

Namespace:

  • System.IO.*
  • UnityEngine.SceneManagement.*

Type:

  • System.AppDomain
  • System.Threading.Process
  • UnityEngine.Input
  • Threeyes.IO.FileIO
  • Threeyes.External.ExternalResources
  • PathTool

Member:

  • UnityEngine.Application.Quit

Note

  • Custom scripts that inherit from ScriptableObject are not supported. Any references to instances of these scripts will resolve to null after packaging.
  • You can download my AliveDesktop_ModUploader template project to better understand the content above.
  • If there are any inaccuracies or omissions in this document, please feel free to point them out. Thank you for your feedback!
Clone this wiki locally