Skip to main content
Version: v3

CoreFrames

Important Attention Reminder

Coding Style wiki


CoreFrames is the unified entry point (Facade) of the CoreFrame module. It exposes four groups of APIs through nested static classes — UIFrame (UI windows), SRFrame (scene resources), USFrame (Unity scenes), and CPFrame (clone prefabs) — covering preloading, showing, closing, hiding, loading, and unloading of interface objects and scenes, all wired into AssetLoader's reference counting.

NamespaceOxGFrame.CoreFrame
Typepublic static class
SourceCoreFrames.cs
using OxGFrame.CoreFrame;

Reminder The managers of each subsystem (UIManager, SRManager, etc.) are created automatically on first use and persist across scenes (DontDestroyOnLoad) — no scene setup is required beforehand.

Attention UIFrame requires a Canvas object in the scene whose name matches UISettings.canvasName on the UI prefab. See the CoreFrame Introduction for setup details.

Quick Start

// Show a UI (data can be passed to the UI's OnShow)
var ui = await CoreFrames.UIFrame.Show("PlayerUI");

// Close the UI
CoreFrames.UIFrame.Close("PlayerUI");

// Show a scene resource (SR)
await CoreFrames.SRFrame.Show("BattleField");

// Load a scene in Single mode (no prefix = bundle scene, using its Address)
await CoreFrames.USFrame.LoadSingleSceneAsync("MainScene");

// Load a scene from Build Settings (build# prefix)
await CoreFrames.USFrame.LoadSingleSceneAsync("build#MainScene");

// Clone a prefab (CP); simply Destroy it when no longer needed
var cp = await CoreFrames.CPFrame.LoadWithCloneAsync<CPBase>("BulletCP");

General Rules

Name Prefix Resolution

CoreFrames has a built-in resolver that determines the loading source based on the name prefix:

PrefixApplicable SubsystemsDescriptionExample
res#UIFrame, SRFrame, CPFrameLoads the asset from Unity's native Resources (by relative path under Resources).res#Prefabs/PlayerUI
build#USFrameLoads the scene from the Scenes In Build list of Build Settings.build#MainScene
NoneAllLoads the asset from the Asset Bundle (YooAsset) by default (using its addressable name).PlayerUI

Package

All loading methods provide packageName overloads:

  • Without packageName: the default package is used automatically (AssetPatcher.GetDefaultPackageName()).
  • With packageName: the asset is loaded from the specified package, useful for multi-package management.

Group (groupId)

UIFrame and SRFrame support multi-group management: every instance opened via Show records a groupId (e.g., lobby-group UIs, battle-group UIs), and batch operations (CloseAll, HideAll, RevealAll, CheckHasAnyHiding) filter their scope by groupId. The framework defines the following internal constants:

ConstantValueDescription
DEFAULT_GROUP_ID0The group id used by overloads that do not take a groupId.
DO_ALL_GROUPS-1Passing -1 as groupId extends the operation to all groups (equivalent to calling the ...ForAllGroups methods).

Progression Callback

The progression parameter of the loading methods is of type OxGFrame.AssetLoader.Progression:

public delegate void Progression(float progress, float currentCount, float totalCount);
  • progress: overall progress (0 to 1).
  • currentCount / totalCount: number of completed items and total items.

Close, Hide & Destroy

  • Close runs the regular closing flow (OnPreCloseOnClose); Hide merely deactivates the object and marks it hidden (triggering OnHide), after which Reveal restores it (triggering OnReveal). A closed object cannot be revealed.
  • Whether Close destroys the instance depends on: the caller passing forceDestroy, or the prefab having allowInstantiate (multi-instance) / onCloseAndDestroy (destroy on close) checked. When an instance is destroyed, the asset is automatically unloaded through AssetLoader (reference counting).
  • Objects with Exclude From Close All (whenCloseAllToSkip) / Exclude From Hide All (whenHideAllToSkip) checked on the prefab are skipped by CloseAll / HideAll; use the ...AndExcluded methods to include them as well.

CoreFrames.UIFrame

The unified UI window API. It manages all UI windows and supports Group multi-group management (e.g., lobby-group UIs, battle-group UIs), Stack management (automatic sorting-order control within a node), reverse switching (reverseChanges), and stack-by-stack closing (allowCloseStackByStack). UI instances are automatically attached to the matching node under the Canvas, based on canvasName and nodeType of the UISettings on the prefab.

Properties

PropertyTypeDefaultDescription
ignoreTimeScaleboolfalseWhether the UI update timing ignores Time.timeScale (uses unscaled time instead).
enableUpdatebooltrueWhether the UI OnUpdate polling is driven.
enableFixedUpdatebooltrueWhether the UI OnFixedUpdate polling is driven.
enableLateUpdatebooltrueWhether the UI OnLateUpdate polling is driven.

Reminder The old names enabledUpdate / enabledFixedUpdate / enabledLateUpdate remain as [Obsolete] forwards; prefer the new names.

Method Overview

Initialization & Canvas Environment

MethodDescription
InitInstanceInitializes the UIManager singleton instance.
SetupAndCheckUICanvasFinds the Canvas object by name, then sets up and checks the UICanvas environment.
GetUICanvasGets the UICanvas component by name.

State Queries

MethodDescription
CheckIsShowingChecks whether the given UI is showing.
CheckIsHidingChecks whether the given UI is hidden (via Hide).
CheckHasAnyHidingChecks whether any UI in the group is hidden.
CheckHasAnyHidingForAllGroupsChecks whether any UI in any group is hidden.
GetStackByStackCountGets the current size of the stack-by-stack close stack.

Component Access

MethodDescription
GetComponent<T>Gets the instance component of the given UI (top of the stack).
GetComponents<T>Gets all instance components of the given UI.

Data Refresh

MethodDescription
SendRefreshDataSends a data refresh notification to specific UIs.
SendRefreshDataToAllBroadcasts a data refresh notification to all UIs.

Preloading & Showing

MethodDescription
PreloadPreloads UI assets into the cache.
ShowLoads and shows a UI, returning its UIBase instance (generic supported).

Closing

MethodDescription
CloseCloses the given UI.
CloseAllCloses all UIs in a group.
CloseAllForAllGroupsCloses all UIs across all groups.
CloseAllAndExcludedCloses all UIs in a group, including those marked as excluded.
CloseAllAndExcludedForAllGroupsCloses all UIs across all groups, including those marked as excluded.
CloseStackByStackCloses the top UI of the given Canvas stack by stack (LIFO).

Hiding & Revealing

MethodDescription
RevealRe-displays a UI that was hidden via Hide.
RevealAllReveals all hidden UIs in a group.
RevealAllForAllGroupsReveals all hidden UIs across all groups.
HideHides the given UI (keeping its instance and state).
HideAllHides all UIs in a group.
HideAllForAllGroupsHides all UIs across all groups.
HideAllAndExcludedHides all UIs in a group, including those marked as excluded.
HideAllAndExcludedForAllGroupsHides all UIs across all groups, including those marked as excluded.

InitInstance

public static void InitInstance()

Description

Explicitly initializes the UIManager singleton instance. The manager object is created automatically and persists across scenes (DontDestroyOnLoad). It is recommended to call this once during game startup so the manager is ready ahead of time.


SetupAndCheckUICanvas

public static bool SetupAndCheckUICanvas(string canvasName)

Parameters

ParameterTypeDescription
canvasNamestringCanvas name (must match a Canvas object in the scene).

Returns

booltrue when the setup succeeds (or has already been done); false with an error log when no matching Canvas is found in the scene.

Description

Finds the Canvas object in the scene by name, then sets up and checks the UICanvas environment (automatically creating the UIRoot, the NodeType nodes, and the Mask / Freeze containers).

Reminder Show runs this flow automatically; you can also call it manually after a scene switch to prepare the UI environment ahead of time.


GetUICanvas

public static UICanvas GetUICanvas(string canvasName)

Parameters

ParameterTypeDescription
canvasNamestringCanvas name.

Returns

UICanvas — the UICanvas component matching the name; null if the environment has not been set up or no match is found.

Description

Gets a UICanvas that has been set up, giving further access to its uiRoot, UI nodes, and the Mask / Freeze managers.


CheckIsShowing

public static bool CheckIsShowing(string assetName)
public static bool CheckIsShowing(UIBase uiBase)

Parameters

ParameterTypeDescription
assetNamestringUI asset name.
uiBaseUIBaseUI instance component.

Returns

booltrue if showing; false if not found or not showing.

Description

Checks whether the given UI is showing. When queried by name, the state of the top instance of the UI's stack is used.


CheckIsHiding

public static bool CheckIsHiding(string assetName)
public static bool CheckIsHiding(UIBase uiBase)

Parameters

ParameterTypeDescription
assetNamestringUI asset name.
uiBaseUIBaseUI instance component.

Returns

booltrue if in the hidden (Hide) state; false if not found or not hidden.

Description

Checks whether the given UI is in the hidden state caused by Hide (the isHidden flag). A UI closed via Close does not count as hidden.


CheckHasAnyHiding

public static bool CheckHasAnyHiding()
public static bool CheckHasAnyHiding(int groupId)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (parameterless overload)

Returns

booltrue when any UI in the group is hidden.

Description

Checks whether any UI in the group is in the hidden state.


CheckHasAnyHidingForAllGroups

public static bool CheckHasAnyHidingForAllGroups()

Returns

booltrue when any UI in any group is hidden.

Description

Behaves like CheckHasAnyHiding, but checks all groups.


GetStackByStackCount

public static int GetStackByStackCount(string canvasName)
public static int GetStackByStackCount(int groupId, string canvasName)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
canvasNamestringCanvas name.

Returns

int — the current size of the stack-by-stack close stack for that group + Canvas; 0 if not found.

Description

Gets the size of the stack-by-stack close stack. Only UIs with allowCloseStackByStack enabled are counted (pushed when opened via Show). Use together with CloseStackByStack.


GetComponent<T>

public static T GetComponent<T>(string assetName) where T : UIBase

Parameters

ParameterTypeDescription
assetNamestringUI asset name.

Returns

T — the top instance component of the UI's stack; null if not found.

Description

Gets the instance component of the given UI, castable to a subclass for advanced operations.

Example

var playerUI = CoreFrames.UIFrame.GetComponent<PlayerUI>("PlayerUI");
if (playerUI != null)
{
// Perform advanced operations on the instance
}

GetComponents<T>

public static T[] GetComponents<T>(string assetName) where T : UIBase

Parameters

ParameterTypeDescription
assetNamestringUI asset name.

Returns

T[] — all instance components of the UI; an empty array if none is found.

Description

Gets all instance components of the given UI. Useful for batch access when multiple instances of a UI with allowInstantiate (multi-instance) enabled exist at once.


SendRefreshData

public static void SendRefreshData(RefreshInfo refreshInfo)
public static void SendRefreshData(RefreshInfo[] refreshInfos)

Parameters

ParameterTypeDescription
refreshInfoRefreshInfoRefresh info struct holding the target UI asset name and the data to pass: new RefreshInfo(assetName, data).
refreshInfosRefreshInfo[]Array of refresh infos (notify multiple UIs in batch).

Description

Sends a refresh notification to all instances of the given UI, triggering their OnReceiveAndRefresh(data) (both showing and hidden instances receive it). Commonly used for language-switch refreshes and display refreshes after receiving server data (e.g., refreshing the money display after a top-up).

Example

// Tell PlayerUI to refresh the coin display
CoreFrames.UIFrame.SendRefreshData(new RefreshInfo("PlayerUI", newCoinAmount));

SendRefreshDataToAll

public static void SendRefreshDataToAll()
public static void SendRefreshDataToAll(object data)
public static void SendRefreshDataToAll(RefreshInfo[] specificRefreshInfos)
public static void SendRefreshDataToAll(object data, RefreshInfo[] specificRefreshInfos)

Parameters

ParameterTypeDescription
dataobjectShared data broadcast to all UIs.
Default: null (notification only, no data)
specificRefreshInfosRefreshInfo[]Specific list. UIs on the list receive the data from their own RefreshInfo, while the rest receive the shared data.

Description

Broadcasts a refresh notification to all UIs, triggering OnReceiveAndRefresh on each instance. Commonly used to refresh every UI after a language switch.

Example

// After switching languages, tell all UIs to refresh their texts
CoreFrames.UIFrame.SendRefreshDataToAll();

Preload

public static async UniTask Preload(string assetName, uint priority = 0, Progression progression = null)
public static async UniTask Preload(string packageName, string assetName, uint priority = 0, Progression progression = null)
public static async UniTask Preload(string[] assetNames, uint priority = 0, Progression progression = null)
public static async UniTask Preload(string packageName, string[] assetNames, uint priority = 0, Progression progression = null)

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
assetNamestringUI asset name (bundle assets use their Address; supports the res# prefix).
assetNamesstring[]Array of UI asset names (batch preloading).
priorityuintAsset loading priority.
Default: 0
progressionProgressionLoading progress callback.
Default: null

Returns

UniTask — an awaitable async operation.

Description

Loads UI assets into the cache ahead of time (without showing them), so a later Show call can use them immediately without a loading delay.

Example

// Preload frequently used UIs in batch
await CoreFrames.UIFrame.Preload(new string[] { "PlayerUI", "SettingsUI" });

Show

public static async UniTask<UIBase> Show(string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f)
public static async UniTask<UIBase> Show(string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f)
public static async UniTask<UIBase> Show(int groupId, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f)
public static async UniTask<UIBase> Show(int groupId, string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f)
public static async UniTask<T> Show<T>(string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f) where T : UIBase
public static async UniTask<T> Show<T>(string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f) where T : UIBase
public static async UniTask<T> Show<T>(int groupId, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f) where T : UIBase
public static async UniTask<T> Show<T>(int groupId, string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f) where T : UIBase

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
packageNamestringPackage name. If omitted, the default package is used.
assetNamestringUI asset name (bundle assets use their Address; supports the res# prefix).
dataobjectData passed to the UI's OnShow(obj).
Default: null
awaitingUIAssetNamestringTransition UI asset name. Shown before the main UI opens (e.g., a loading overlay) and closed automatically once the main UI has opened.
Default: null (no transition UI)
priorityuintAsset loading priority.
Default: 0
progressionProgressionLoading progress callback.
Default: null
parentTransformParent node to attach to.
Default: null (attached automatically to the matching node under the UICanvas, based on uiSettings.nodeType)
awaitingUIExtraDurationfloatExtra time in seconds the transition UI stays visible.
Default: 0f

Returns

UniTask<UIBase> — the opened UI instance component (generic overloads return UniTask<T>); null with an error log when loading fails (asset not found).

Description

Loads and shows a UI, recording its groupId for batch-operation filtering. Opening triggers OnPreShowOnShow in order.

Attention
  • If the same UI is already showing and allowInstantiate is not checked, it is not opened again — a warning is logged and the existing instance is returned.
  • When a UI with reverseChanges (reverse switching) enabled opens, the previous UI in the reverse stack of the same Canvas is hidden automatically; closing it restores the previous UI.

Example

// Open a UI and pass data
var ui = await CoreFrames.UIFrame.Show("PlayerUI", new PlayerData(100));

// Open generically to get the subclass directly
var playerUI = await CoreFrames.UIFrame.Show<PlayerUI>("PlayerUI");

// Open with a specific group and package
await CoreFrames.UIFrame.Show(1, "OtherPackage", "BattleUI");

// Show a transition UI first (staying an extra 0.5 seconds)
await CoreFrames.UIFrame.Show("LobbyUI", null, "LoadingUI", awaitingUIExtraDuration: 0.5f);

Close

public static void Close(string assetName, bool disableOnPreClose = false, bool forceDestroy = false)

Parameters

ParameterTypeDescription
assetNamestringUI asset name.
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instance forcibly. If not forced, the allowInstantiate / onCloseAndDestroy settings on the prefab decide.
Default: false

Description

Closes the given UI (for multi-instance UIs, the top instance of the stack). Does nothing when the UI is not showing and forceDestroy is not passed. When instances are destroyed, the asset is unloaded accordingly (see Close, Hide & Destroy).

Example

// Regular close (the prefab settings decide whether to destroy)
CoreFrames.UIFrame.Close("PlayerUI");

// Force destroy + skip OnPreClose
CoreFrames.UIFrame.Close("PlayerUI", true, true);

CloseAll

public static void CloseAll(bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
public static void CloseAll(int groupId, bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instances forcibly.
Default: false
withoutAssetNamesparams string[]Exclusion list. UIs on the list are not closed.

Description

Closes all UIs in the group (including every instance in each UI's stack).

Attention
  • UIs with Exclude From Close All (whenCloseAllToSkip) checked are skipped — use CloseAllAndExcluded instead.
  • UIs that are not showing are skipped (unless forceDestroy is passed or the UI has allowInstantiate checked).

Example

// Close all UIs in the default group, but keep MainMenuUI
CoreFrames.UIFrame.CloseAll(false, false, "MainMenuUI");

CloseAllForAllGroups

public static void CloseAllForAllGroups(bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instances forcibly.
Default: false
withoutAssetNamesparams string[]Exclusion list.

Description

Behaves like CloseAll, but applies to all groups.


CloseAllAndExcluded

public static void CloseAllAndExcluded(bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
public static void CloseAllAndExcluded(int groupId, bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instances forcibly.
Default: false
withoutAssetNamesparams string[]Exclusion list (still effective).

Description

Behaves like CloseAll, but also closes UIs with Exclude From Close All (whenCloseAllToSkip) checked.


CloseAllAndExcludedForAllGroups

public static void CloseAllAndExcludedForAllGroups(bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instances forcibly.
Default: false
withoutAssetNamesparams string[]Exclusion list.

Description

Behaves like CloseAllAndExcluded, but applies to all groups.


CloseStackByStack

public static void CloseStackByStack(string canvasName, bool disableOnPreClose = false, bool forceDestroy = false)
public static void CloseStackByStack(int groupId, string canvasName, bool disableOnPreClose = false, bool forceDestroy = false)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
canvasNamestringCanvas name.
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instance forcibly.
Default: false

Description

Closes the topmost (most recently opened) UI in the stack-by-stack close stack of the given group + Canvas (LIFO). Only affects UIs with allowCloseStackByStack enabled — commonly used to implement back-key behavior that closes windows one layer at a time.

Example

// Back key: close the top UI layer by layer
if (CoreFrames.UIFrame.GetStackByStackCount("Canvas") > 0)
CoreFrames.UIFrame.CloseStackByStack("Canvas");

Reveal

public static void Reveal(string assetName)

Parameters

ParameterTypeDescription
assetNamestringUI asset name.

Description

Re-displays a UI hidden via Hide, triggering OnReveal (not OnShow). Only works on hidden UIs (a UI closed via Close cannot be revealed); a warning is logged if the UI is already showing.


RevealAll

public static void RevealAll()
public static void RevealAll(int groupId)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (parameterless overload)

Description

Reveals all hidden UIs in the group.


RevealAllForAllGroups

public static void RevealAllForAllGroups()

Description

Behaves like RevealAll, but applies to all groups.


Hide

public static void Hide(string assetName)

Parameters

ParameterTypeDescription
assetNamestringUI asset name.

Description

Hides all instances of the given UI (only deactivating the objects and setting the isHidden flag, keeping instances and data state), triggering OnHide. The UI can then be restored via Reveal or Show.

Example

// Hide temporarily (state preserved)
CoreFrames.UIFrame.Hide("PlayerUI");

// Reveal again
CoreFrames.UIFrame.Reveal("PlayerUI");

HideAll

public static void HideAll(params string[] withoutAssetNames)
public static void HideAll(int groupId, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
withoutAssetNamesparams string[]Exclusion list. UIs on the list are not hidden.

Description

Hides all UIs in the group.

Attention UIs with Exclude From Hide All (whenHideAllToSkip) checked are skipped (unless the UI has reverseChanges enabled, in which case it is still hidden) — use HideAllAndExcluded instead.


HideAllForAllGroups

public static void HideAllForAllGroups(params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
withoutAssetNamesparams string[]Exclusion list.

Description

Behaves like HideAll, but applies to all groups.


HideAllAndExcluded

public static void HideAllAndExcluded(params string[] withoutAssetNames)
public static void HideAllAndExcluded(int groupId, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
withoutAssetNamesparams string[]Exclusion list (still effective).

Description

Behaves like HideAll, but also hides UIs with Exclude From Hide All (whenHideAllToSkip) checked.


HideAllAndExcludedForAllGroups

public static void HideAllAndExcludedForAllGroups(params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
withoutAssetNamesparams string[]Exclusion list.

Description

Behaves like HideAllAndExcluded, but applies to all groups.


CoreFrames.SRFrame

The unified Scene Resource API. It manages 3D resources in a scene (such as NPCs, buildings, effect objects, in-scene management components, an AudioListener, etc.). Its operation logic mirrors UIFrame (group management, Show / Close / Hide / Reveal, data refresh), but without the Canvas node and stack sorting mechanics. Instances are attached under the SRManager node by default.

Properties

PropertyTypeDefaultDescription
ignoreTimeScaleboolfalseWhether the SR update timing ignores Time.timeScale (uses unscaled time instead).
enableUpdatebooltrueWhether the SR OnUpdate polling is driven.
enableFixedUpdatebooltrueWhether the SR OnFixedUpdate polling is driven.
enableLateUpdatebooltrueWhether the SR OnLateUpdate polling is driven.

Reminder The old names enabledUpdate / enabledFixedUpdate / enabledLateUpdate remain as [Obsolete] forwards; prefer the new names.

Method Overview

Initialization

MethodDescription
InitInstanceInitializes the SRManager singleton instance.

State Queries

MethodDescription
CheckIsShowingChecks whether the given SR is showing.
CheckIsHidingChecks whether the given SR is hidden (via Hide).
CheckHasAnyHidingChecks whether any SR in the group is hidden.
CheckHasAnyHidingForAllGroupsChecks whether any SR in any group is hidden.

Component Access

MethodDescription
GetComponent<T>Gets the instance component of the given SR (top of the stack).
GetComponents<T>Gets all instance components of the given SR.

Data Refresh

MethodDescription
SendRefreshDataSends a data refresh notification to specific SRs.
SendRefreshDataToAllBroadcasts a data refresh notification to all SRs.

Preloading & Showing

MethodDescription
PreloadPreloads SR assets into the cache.
ShowLoads and shows an SR, returning its SRBase instance (generic supported).

Closing

MethodDescription
CloseCloses the given SR.
CloseAllCloses all SRs in a group.
CloseAllForAllGroupsCloses all SRs across all groups.
CloseAllAndExcludedCloses all SRs in a group, including those marked as excluded.
CloseAllAndExcludedForAllGroupsCloses all SRs across all groups, including those marked as excluded.

Hiding & Revealing

MethodDescription
RevealRe-displays an SR that was hidden via Hide.
RevealAllReveals all hidden SRs in a group.
RevealAllForAllGroupsReveals all hidden SRs across all groups.
HideHides the given SR (keeping its instance and state).
HideAllHides all SRs in a group.
HideAllForAllGroupsHides all SRs across all groups.
HideAllAndExcludedHides all SRs in a group, including those marked as excluded.
HideAllAndExcludedForAllGroupsHides all SRs across all groups, including those marked as excluded.

InitInstance

public static void InitInstance()

Description

Explicitly initializes the SRManager singleton instance. The manager object is created automatically and persists across scenes (DontDestroyOnLoad). It is recommended to call this once during game startup so the manager is ready ahead of time.


CheckIsShowing

public static bool CheckIsShowing(string assetName)
public static bool CheckIsShowing(SRBase srBase)

Parameters

ParameterTypeDescription
assetNamestringSR asset name.
srBaseSRBaseSR instance component.

Returns

booltrue if showing; false if not found or not showing.

Description

Checks whether the given SR is showing. When queried by name, the state of the top instance of the SR's stack is used.


CheckIsHiding

public static bool CheckIsHiding(string assetName)
public static bool CheckIsHiding(SRBase srBase)

Parameters

ParameterTypeDescription
assetNamestringSR asset name.
srBaseSRBaseSR instance component.

Returns

booltrue if in the hidden (Hide) state; false if not found or not hidden.

Description

Checks whether the given SR is in the hidden state caused by Hide (the isHidden flag). An SR closed via Close does not count as hidden.


CheckHasAnyHiding

public static bool CheckHasAnyHiding()
public static bool CheckHasAnyHiding(int groupId)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (parameterless overload)

Returns

booltrue when any SR in the group is hidden.

Description

Checks whether any SR in the group is in the hidden state.


CheckHasAnyHidingForAllGroups

public static bool CheckHasAnyHidingForAllGroups()

Returns

booltrue when any SR in any group is hidden.

Description

Behaves like CheckHasAnyHiding, but checks all groups.


GetComponent<T>

public static T GetComponent<T>(string assetName) where T : SRBase

Parameters

ParameterTypeDescription
assetNamestringSR asset name.

Returns

T — the top instance component of the SR's stack; null if not found.

Description

Gets the instance component of the given SR, castable to a subclass for advanced operations.

Example

var battleField = CoreFrames.SRFrame.GetComponent<BattleFieldSR>("BattleField");

GetComponents<T>

public static T[] GetComponents<T>(string assetName) where T : SRBase

Parameters

ParameterTypeDescription
assetNamestringSR asset name.

Returns

T[] — all instance components of the SR; an empty array if none is found.

Description

Gets all instance components of the given SR. Useful for batch access when multiple instances of an SR with allowInstantiate (multi-instance) enabled exist at once.


SendRefreshData

public static void SendRefreshData(RefreshInfo refreshInfo)
public static void SendRefreshData(RefreshInfo[] refreshInfos)

Parameters

ParameterTypeDescription
refreshInfoRefreshInfoRefresh info struct holding the target SR asset name and the data to pass: new RefreshInfo(assetName, data).
refreshInfosRefreshInfo[]Array of refresh infos (notify multiple SRs in batch).

Description

Sends a refresh notification to all instances of the given SR, triggering their OnReceiveAndRefresh(data) (both showing and hidden instances receive it).


SendRefreshDataToAll

public static void SendRefreshDataToAll()
public static void SendRefreshDataToAll(object data)
public static void SendRefreshDataToAll(RefreshInfo[] specificRefreshInfos)
public static void SendRefreshDataToAll(object data, RefreshInfo[] specificRefreshInfos)

Parameters

ParameterTypeDescription
dataobjectShared data broadcast to all SRs.
Default: null (notification only, no data)
specificRefreshInfosRefreshInfo[]Specific list. SRs on the list receive the data from their own RefreshInfo, while the rest receive the shared data.

Description

Broadcasts a refresh notification to all SRs, triggering OnReceiveAndRefresh on each instance.


Preload

public static async UniTask Preload(string assetName, uint priority = 0, Progression progression = null)
public static async UniTask Preload(string packageName, string assetName, uint priority = 0, Progression progression = null)
public static async UniTask Preload(string[] assetNames, uint priority = 0, Progression progression = null)
public static async UniTask Preload(string packageName, string[] assetNames, uint priority = 0, Progression progression = null)

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
assetNamestringSR asset name (bundle assets use their Address; supports the res# prefix).
assetNamesstring[]Array of SR asset names (batch preloading).
priorityuintAsset loading priority.
Default: 0
progressionProgressionLoading progress callback.
Default: null

Returns

UniTask — an awaitable async operation.

Description

Loads SR assets into the cache ahead of time (without showing them), so a later Show call can use them immediately without a loading delay, improving runtime performance.

Example

await CoreFrames.SRFrame.Preload("BattleField");

Show

public static async UniTask<SRBase> Show(string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f)
public static async UniTask<SRBase> Show(string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f)
public static async UniTask<SRBase> Show(int groupId, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f)
public static async UniTask<SRBase> Show(int groupId, string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f)
public static async UniTask<T> Show<T>(string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f) where T : SRBase
public static async UniTask<T> Show<T>(string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f) where T : SRBase
public static async UniTask<T> Show<T>(int groupId, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f) where T : SRBase
public static async UniTask<T> Show<T>(int groupId, string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null, float awaitingUIExtraDuration = 0f) where T : SRBase

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
packageNamestringPackage name. If omitted, the default package is used.
assetNamestringSR asset name (bundle assets use their Address; supports the res# prefix).
dataobjectData passed to the SR's OnShow(obj).
Default: null
awaitingUIAssetNamestringTransition UI asset name (a UIFrame UI). Shown before the SR opens and closed automatically once the SR has opened.
Default: null (no transition UI)
priorityuintAsset loading priority.
Default: 0
progressionProgressionLoading progress callback.
Default: null
parentTransformParent node to attach to.
Default: null (attached under the SRManager node)
awaitingUIExtraDurationfloatExtra time in seconds the transition UI stays visible.
Default: 0f

Returns

UniTask<SRBase> — the opened SR instance component (generic overloads return UniTask<T>); null with an error log when loading fails (asset not found).

Description

Loads and shows a scene resource, recording its groupId for batch-operation filtering. Opening triggers OnPreShowOnShow in order.

Attention If the same SR is already showing and allowInstantiate is not checked, it is not opened again — a warning is logged and the existing instance is returned.

Example

// Show a scene resource
var sr = await CoreFrames.SRFrame.Show("BattleField");

// Open generically with a specific parent
var npc = await CoreFrames.SRFrame.Show<NpcSR>("VillageNpc", parent: npcRoot);

// Open with a specific group
await CoreFrames.SRFrame.Show(2, "BattleEffects");

Close

public static void Close(string assetName, bool disableOnPreClose = false, bool forceDestroy = false)

Parameters

ParameterTypeDescription
assetNamestringSR asset name.
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instance forcibly. If not forced, the allowInstantiate / onCloseAndDestroy settings on the prefab decide.
Default: false

Description

Closes the given SR (for multi-instance SRs, the top instance of the stack). Does nothing when the SR is not showing and forceDestroy is not passed. When instances are destroyed, the asset is unloaded accordingly (see Close, Hide & Destroy).

Example

CoreFrames.SRFrame.Close("BattleField");

CloseAll

public static void CloseAll(bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
public static void CloseAll(int groupId, bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instances forcibly.
Default: false
withoutAssetNamesparams string[]Exclusion list. SRs on the list are not closed.

Description

Closes all SRs in the group (including every instance in each SR's stack).

Attention
  • SRs with Exclude From Close All (whenCloseAllToSkip) checked are skipped — use CloseAllAndExcluded instead.
  • SRs that are not showing are skipped (unless forceDestroy is passed).

CloseAllForAllGroups

public static void CloseAllForAllGroups(bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instances forcibly.
Default: false
withoutAssetNamesparams string[]Exclusion list.

Description

Behaves like CloseAll, but applies to all groups.


CloseAllAndExcluded

public static void CloseAllAndExcluded(bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
public static void CloseAllAndExcluded(int groupId, bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instances forcibly.
Default: false
withoutAssetNamesparams string[]Exclusion list (still effective).

Description

Behaves like CloseAll, but also closes SRs with Exclude From Close All (whenCloseAllToSkip) checked.


CloseAllAndExcludedForAllGroups

public static void CloseAllAndExcludedForAllGroups(bool disableOnPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
disableOnPreCloseboolWhether to skip the OnPreClose callback.
Default: false
forceDestroyboolWhether to destroy the instances forcibly.
Default: false
withoutAssetNamesparams string[]Exclusion list.

Description

Behaves like CloseAllAndExcluded, but applies to all groups.


Reveal

public static void Reveal(string assetName)

Parameters

ParameterTypeDescription
assetNamestringSR asset name.

Description

Re-displays an SR hidden via Hide, triggering OnReveal (not OnShow). Only works on hidden SRs (an SR closed via Close cannot be revealed); a warning is logged if the SR is already showing.


RevealAll

public static void RevealAll()
public static void RevealAll(int groupId)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (parameterless overload)

Description

Reveals all hidden SRs in the group.


RevealAllForAllGroups

public static void RevealAllForAllGroups()

Description

Behaves like RevealAll, but applies to all groups.


Hide

public static void Hide(string assetName)

Parameters

ParameterTypeDescription
assetNamestringSR asset name.

Description

Hides all instances of the given SR (only deactivating the objects and setting the isHidden flag, keeping instances and data state), triggering OnHide. The SR can then be restored via Reveal or Show.

Example

// Hide the scene resource temporarily (state preserved)
CoreFrames.SRFrame.Hide("BattleField");

// Reveal again
CoreFrames.SRFrame.Reveal("BattleField");

HideAll

public static void HideAll(params string[] withoutAssetNames)
public static void HideAll(int groupId, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
withoutAssetNamesparams string[]Exclusion list. SRs on the list are not hidden.

Description

Hides all SRs in the group.

Attention SRs with Exclude From Hide All (whenHideAllToSkip) checked are skipped — use HideAllAndExcluded instead.


HideAllForAllGroups

public static void HideAllForAllGroups(params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
withoutAssetNamesparams string[]Exclusion list.

Description

Behaves like HideAll, but applies to all groups.


HideAllAndExcluded

public static void HideAllAndExcluded(params string[] withoutAssetNames)
public static void HideAllAndExcluded(int groupId, params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
groupIdintGroup id.
Default: 0 (overloads without it)
withoutAssetNamesparams string[]Exclusion list (still effective).

Description

Behaves like HideAll, but also hides SRs with Exclude From Hide All (whenHideAllToSkip) checked.


HideAllAndExcludedForAllGroups

public static void HideAllAndExcludedForAllGroups(params string[] withoutAssetNames)

Parameters

ParameterTypeDescription
withoutAssetNamesparams string[]Exclusion list.

Description

Behaves like HideAllAndExcluded, but applies to all groups.


CoreFrames.USFrame

The unified Unity Scene API. An enhanced scene management system that wraps Unity's native SceneManager and extends it with bundle scene support — Single / Additive multi-scene loading, combined main + sub scene loading, merged progress reporting, frame-sliced root-object activation, and scene unloading.

Reminder Scene names support the build# prefix: with the prefix, scenes load from Build Settings; without it, they load from the Asset Bundle (YooAsset) (see Name Prefix Resolution).

Method Overview

Initialization & Scene Queries

MethodDescription
InitInstanceInitializes the USManager singleton instance.
SceneCountGets the number of currently loaded scenes.
GetActiveSceneGets the current active scene.
GetSceneAtGets a loaded scene by index.
GetSceneByNameGets a loaded scene by name.
GetSceneByBuildIndexGets a loaded scene by build index.
GetAllScenesGets all (or filtered) loaded scenes.

Scene Operations

MethodDescription
CreateSceneCreates a new empty scene.
MergeScenesMerges two scenes.
MoveGameObjectToSceneMoves a GameObject to the given scene.
MoveGameObjectToActiveSceneMoves a GameObject to the active scene.
SetActiveSceneSets the active scene.
SetActiveSceneRootGameObjectsSets the active state of a scene's root objects in batch.
SetActiveSceneRootGameObjectsAsyncSets the active state of a scene's root objects in frame-sliced batches.

Scene Loading (Async)

MethodDescription
LoadSingleSceneAsyncLoads a scene asynchronously in Single mode.
LoadAdditiveSceneAsyncLoads a scene asynchronously in Additive mode.
LoadMainAndSubScenesAsyncLoads one main scene plus multiple sub scenes at once (merged progress).
LoadSubScenesAsyncLoads multiple Additive sub scenes in batch (merged progress).
LoadSceneAsyncGeneral-purpose async scene loading (explicit LoadSceneMode).

Scene Loading (Sync)

MethodDescription
LoadSingleSceneLoads a scene synchronously in Single mode.
LoadAdditiveSceneLoads a scene synchronously in Additive mode.
LoadMainAndSubScenesLoads one main scene plus multiple sub scenes at once (sync).
LoadSubScenesLoads multiple Additive sub scenes in batch (sync).
LoadSceneGeneral-purpose sync scene loading (explicit LoadSceneMode).

Unloading

MethodDescription
UnloadUnloads scenes (by name or build index).

InitInstance

public static void InitInstance()

Description

Explicitly initializes the USManager singleton instance (a plain C# singleton, not a MonoBehaviour). It is recommended to call this once during game startup.


SceneCount

public static int SceneCount()

Returns

int — the number of currently loaded scenes (same as SceneManager.sceneCount).

Description

Gets the number of currently loaded scenes.


GetActiveScene

public static Scene GetActiveScene()

Returns

Scene — the current active scene (same as SceneManager.GetActiveScene()).

Description

Gets the current active scene.


GetSceneAt

public static Scene GetSceneAt(int index)

Parameters

ParameterTypeDescription
indexintIndex in the loaded-scene list (0 to SceneCount - 1).

Returns

Scene — the scene at the given index.

Description

Gets a loaded scene by index (same as SceneManager.GetSceneAt).


GetSceneByName

public static Scene GetSceneByName(string sceneName)

Parameters

ParameterTypeDescription
sceneNamestringScene name.

Returns

Scene — the loaded scene matching the name; if not found, the returned Scene is invalid (IsValid() is false).

Description

Gets a loaded scene by name (same as SceneManager.GetSceneByName).


GetSceneByBuildIndex

public static Scene GetSceneByBuildIndex(int buildIndex)

Parameters

ParameterTypeDescription
buildIndexintScene index in Build Settings.

Returns

Scene — the loaded scene with the given build index; if not loaded, the returned Scene is invalid.

Description

Gets a loaded scene by build index (same as SceneManager.GetSceneByBuildIndex).


GetAllScenes

public static Scene[] GetAllScenes(params string[] sceneNames)
public static Scene[] GetAllScenes(params int[] buildIndexes)

Parameters

ParameterTypeDescription
sceneNamesparams string[]Scene-name filter. When omitted, all loaded scenes are returned.
buildIndexesparams int[]Build-index filter. When omitted, all loaded scenes are returned.

Returns

Scene[] — the loaded scenes matching the filter; an empty array if none matches.

Description

Gets all loaded scenes, optionally filtered by name or build index.


CreateScene

public static Scene CreateScene(string sceneName, CreateSceneParameters parameters)

Parameters

ParameterTypeDescription
sceneNamestringName of the new scene.
parametersCreateSceneParametersScene creation parameters (including LocalPhysicsMode).

Returns

Scene — the created empty scene.

Description

Creates a new empty scene at runtime (same as SceneManager.CreateScene).


MergeScenes

public static bool MergeScenes(Scene sourceScene, Scene targetScene)

Parameters

ParameterTypeDescription
sourceSceneSceneSource scene (unloaded after the merge).
targetSceneSceneTarget scene (receives all objects of the source scene).

Returns

booltrue on success; false with an exception log when an exception occurs.

Description

Merges all GameObjects of the source scene into the target scene (same as SceneManager.MergeScenes).


MoveGameObjectToScene

public static bool MoveGameObjectToScene(GameObject go, Scene targetScene)

Parameters

ParameterTypeDescription
goGameObjectObject to move (must be a scene root object).
targetSceneSceneTarget scene.

Returns

booltrue on success; false with an exception log when an exception occurs.

Description

Moves a GameObject to the given scene (same as SceneManager.MoveGameObjectToScene).


MoveGameObjectToActiveScene

public static bool MoveGameObjectToActiveScene(GameObject go)

Parameters

ParameterTypeDescription
goGameObjectObject to move (must be a scene root object).

Returns

booltrue on success; false with an exception log when an exception occurs.

Description

Moves a GameObject to the current active scene.


SetActiveScene

public static bool SetActiveScene(int index)
public static bool SetActiveScene(string sceneName)
public static bool SetActiveScene(Scene scene)

Parameters

ParameterTypeDescription
indexintIndex in the loaded-scene list.
sceneNamestringScene name.
sceneSceneScene handle.

Returns

booltrue on success (same as SceneManager.SetActiveScene).

Description

Sets the active scene. In a multi-scene Additive setup, newly spawned objects belong to the active scene.

Example

// After loading a sub scene, switch the active scene over
await CoreFrames.USFrame.LoadAdditiveSceneAsync("BattleScene");
CoreFrames.USFrame.SetActiveScene("BattleScene");

SetActiveSceneRootGameObjects

public static void SetActiveSceneRootGameObjects(string sceneName, bool active, params string[] withoutRootGameObjectNames)
public static void SetActiveSceneRootGameObjects(Scene scene, bool active, string[] withoutRootGameObjectNames = null)

Parameters

ParameterTypeDescription
sceneNamestringScene name. When multiple scenes share the name, all of them are processed.
sceneSceneScene handle.
activeboolThe active state to set.
withoutRootGameObjectNamesparams string[]Exclusion list. Root objects on the list keep their state.

Description

Sets the active state of a scene's root objects in batch. Logs an error/warning and does nothing when the scene is invalid or not fully loaded. Commonly paired with scenes loaded with activeRootGameObjects: false, activating the content at the right moment.


SetActiveSceneRootGameObjectsAsync

public async static UniTask SetActiveSceneRootGameObjectsAsync(string sceneName, bool active, int framesInterval = 1, int activeObjectsPerInterval = 3, params string[] withoutRootGameObjectNames)
public async static UniTask SetActiveSceneRootGameObjectsAsync(Scene scene, bool active, int framesInterval = 1, int activeObjectsPerInterval = 3, params string[] withoutRootGameObjectNames)

Parameters

ParameterTypeDescription
sceneNamestringScene name. When multiple scenes share the name, all of them are processed.
sceneSceneScene handle.
activeboolThe active state to set.
framesIntervalintNumber of frames to wait between batches.
Default: 1
activeObjectsPerIntervalintNumber of root objects processed per batch.
Default: 3
withoutRootGameObjectNamesparams string[]Exclusion list.

Returns

UniTask — an awaitable async operation.

Description

Sets the active state of a scene's root objects in frame-sliced batches (after every activeObjectsPerInterval objects, waits framesInterval frames), avoiding hitches caused by activating many objects in a single frame.

Example

// Activate 5 root objects every 2 frames for a smooth ramp-up
await CoreFrames.USFrame.SetActiveSceneRootGameObjectsAsync("BattleScene", true, 2, 5);

LoadSingleSceneAsync

public static async UniTask LoadSingleSceneAsync(string sceneName, Progression progression = null)
public static async UniTask<T> LoadSingleSceneAsync<T>(string sceneName, Progression progression = null) where T : class
public static async UniTask LoadSingleSceneAsync(string packageName, string sceneName, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, Progression progression = null)
public static async UniTask<T> LoadSingleSceneAsync<T>(string packageName, string sceneName, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, Progression progression = null) where T : class

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
sceneNamestringScene name (supports the build# prefix).
localPhysicsModeLocalPhysicsModeLocal physics mode for the scene.
Default: LocalPhysicsMode.None
progressionProgressionLoading progress callback.
Default: null

Returns

UniTask — an awaitable async operation. Generic overloads return UniTask<T>: an AsyncOperation for build scenes, a BundlePack for bundle scenes (cast via as T; null when the type does not match).

Description

Loads a scene asynchronously in Single mode (replacing the existing scenes).

Attention If a scene with the same name is already loaded, a warning is logged and it is not loaded again.

Example

// Load a bundle scene (by Address)
await CoreFrames.USFrame.LoadSingleSceneAsync("MainScene");

// Load a Build Settings scene and watch the progress
await CoreFrames.USFrame.LoadSingleSceneAsync("build#MainScene", (progress, current, total) =>
{
Debug.Log($"Loading progress: {progress * 100}%");
});

LoadAdditiveSceneAsync

public static async UniTask LoadAdditiveSceneAsync(string sceneName, bool activateOnLoad = true, uint priority = 100, Progression progression = null)
public static async UniTask LoadAdditiveSceneAsync(string sceneName, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, bool activeRootGameObjects = true, bool activateOnLoad = true, uint priority = 100, Progression progression = null)
public static async UniTask<T> LoadAdditiveSceneAsync<T>(string sceneName, bool activateOnLoad = true, uint priority = 100, Progression progression = null) where T : class
public static async UniTask<T> LoadAdditiveSceneAsync<T>(string sceneName, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, bool activeRootGameObjects = true, bool activateOnLoad = true, uint priority = 100, Progression progression = null) where T : class
public static async UniTask LoadAdditiveSceneAsync(string packageName, string sceneName, bool activateOnLoad = true, uint priority = 100, Progression progression = null)
public static async UniTask LoadAdditiveSceneAsync(string packageName, string sceneName, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, bool activeRootGameObjects = true, bool activateOnLoad = true, uint priority = 100, Progression progression = null)
public static async UniTask<T> LoadAdditiveSceneAsync<T>(string packageName, string sceneName, bool activateOnLoad = true, uint priority = 100, Progression progression = null) where T : class
public static async UniTask<T> LoadAdditiveSceneAsync<T>(string packageName, string sceneName, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, bool activeRootGameObjects = true, bool activateOnLoad = true, uint priority = 100, Progression progression = null) where T : class

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
sceneNamestringScene name (supports the build# prefix).
localPhysicsModeLocalPhysicsModeLocal physics mode for the scene.
Default: LocalPhysicsMode.None
activeRootGameObjectsboolWhether to keep the scene's root objects active after loading. When false, all root objects are deactivated automatically after loading (they can be activated later via SetActiveSceneRootGameObjects).
Default: true
activateOnLoadboolWhether the scene activates automatically when loaded (bundle scenes only).
Default: true
priorityuintScene loading priority (bundle scenes only).
Default: 100
progressionProgressionLoading progress callback.
Default: null

Returns

UniTask — an awaitable async operation. Generic overloads return UniTask<T>: an AsyncOperation for build scenes, a BundlePack for bundle scenes (cast via as T; null when the type does not match).

Description

Loads a scene asynchronously in Additive mode (without unloading existing scenes).

Example

// Load a sub scene additively
await CoreFrames.USFrame.LoadAdditiveSceneAsync("EnvironmentScene");

// Load without activating root objects, then activate them frame by frame later
await CoreFrames.USFrame.LoadAdditiveSceneAsync("HeavyScene", LocalPhysicsMode.None, false);
await CoreFrames.USFrame.SetActiveSceneRootGameObjectsAsync("HeavyScene", true);

LoadMainAndSubScenesAsync

public static async UniTask LoadMainAndSubScenesAsync(string singleSceneName, AdditiveSceneInfo[] additiveSceneInfos, uint priority = 100, Progression progression = null)
public static async UniTask LoadMainAndSubScenesAsync(string singleSceneName, LocalPhysicsMode localPhysicsMode, AdditiveSceneInfo[] additiveSceneInfos, uint priority = 100, Progression progression = null)
public static async UniTask LoadMainAndSubScenesAsync(string packageName, string singleSceneName, AdditiveSceneInfo[] additiveSceneInfos, uint priority = 100, Progression progression = null)
public static async UniTask LoadMainAndSubScenesAsync(string packageName, string singleSceneName, LocalPhysicsMode localPhysicsMode, AdditiveSceneInfo[] additiveSceneInfos, uint priority = 100, Progression progression = null)

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
singleSceneNamestringMain scene name (loaded in Single mode; supports the build# prefix).
localPhysicsModeLocalPhysicsModeLocal physics mode for the main scene.
Default: LocalPhysicsMode.None (overloads without it)
additiveSceneInfosAdditiveSceneInfo[]Sub-scene info array (loaded in Additive mode, in order).
priorityuintScene loading priority (incremented per sub scene; bundle scenes only).
Default: 100
progressionProgressionLoading progress callback (main + sub scenes merged into a single progress report).
Default: null

AdditiveSceneInfo struct fields:

FieldTypeDescription
sceneNamestringSub-scene name (supports the build# prefix).
activeRootGameObjectsboolWhether to keep the scene's root objects active after loading.
localPhysicsModeLocalPhysicsModeLocal physics mode for the sub scene.

Returns

UniTask — an awaitable async operation.

Description

Loads one Single main scene plus multiple Additive sub scenes in one call, with progress merged into a single progression report (0 to 1).

Attention If the main scene is already loaded, a warning is logged and the whole flow is aborted (sub scenes are not loaded either).

Example

// Load the main scene + two sub scenes at once
await CoreFrames.USFrame.LoadMainAndSubScenesAsync(
"BattleScene",
new AdditiveSceneInfo[]
{
new AdditiveSceneInfo { sceneName = "EnvironmentScene", activeRootGameObjects = true },
new AdditiveSceneInfo { sceneName = "LightingScene", activeRootGameObjects = true }
},
progression: (progress, current, total) => Debug.Log($"Total progress: {progress * 100}%")
);

LoadSubScenesAsync

public static async UniTask LoadSubScenesAsync(AdditiveSceneInfo[] additiveSceneInfos, uint priority = 100, Progression progression = null)
public static async UniTask LoadSubScenesAsync(string packageName, AdditiveSceneInfo[] additiveSceneInfos, uint priority = 100, Progression progression = null)

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
additiveSceneInfosAdditiveSceneInfo[]Sub-scene info array (see LoadMainAndSubScenesAsync for the fields).
priorityuintScene loading priority (incremented per sub scene; bundle scenes only).
Default: 100
progressionProgressionLoading progress callback (all sub scenes merged into a single progress report).
Default: null

Returns

UniTask — an awaitable async operation.

Description

Loads multiple Additive sub scenes in batch (without a main scene), with merged progress reporting.


LoadSceneAsync

public static async UniTask LoadSceneAsync(string sceneName, LoadSceneMode loadSceneMode, bool activateOnLoad = true, uint priority = 100, Progression progression = null)
public static async UniTask LoadSceneAsync(string sceneName, LoadSceneMode loadSceneMode, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, bool activateOnLoad = true, uint priority = 100, Progression progression = null)
public static async UniTask<T> LoadSceneAsync<T>(string sceneName, LoadSceneMode loadSceneMode, bool activateOnLoad = true, uint priority = 100, Progression progression = null) where T : class
public static async UniTask<T> LoadSceneAsync<T>(string sceneName, LoadSceneMode loadSceneMode, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, bool activateOnLoad = true, uint priority = 100, Progression progression = null) where T : class
public static async UniTask LoadSceneAsync(string packageName, string sceneName, LoadSceneMode loadSceneMode, bool activateOnLoad = true, uint priority = 100, Progression progression = null)
public static async UniTask LoadSceneAsync(string packageName, string sceneName, LoadSceneMode loadSceneMode, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, bool activateOnLoad = true, uint priority = 100, Progression progression = null)
public static async UniTask<T> LoadSceneAsync<T>(string packageName, string sceneName, LoadSceneMode loadSceneMode, bool activateOnLoad = true, uint priority = 100, Progression progression = null) where T : class
public static async UniTask<T> LoadSceneAsync<T>(string packageName, string sceneName, LoadSceneMode loadSceneMode, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, bool activateOnLoad = true, uint priority = 100, Progression progression = null) where T : class
public static async UniTask<AsyncOperation> LoadSceneAsync(int buildIndex, LoadSceneMode loadSceneMode = LoadSceneMode.Single, Progression progression = null)
public static async UniTask<AsyncOperation> LoadSceneAsync(int buildIndex, LoadSceneMode loadSceneMode = LoadSceneMode.Single, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, Progression progression = null)

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
sceneNamestringScene name (supports the build# prefix).
buildIndexintScene index in Build Settings (these overloads load from Build only).
loadSceneModeLoadSceneModeLoad mode (Single / Additive).
Default: LoadSceneMode.Single (buildIndex overloads)
localPhysicsModeLocalPhysicsModeLocal physics mode for the scene.
Default: LocalPhysicsMode.None
activateOnLoadboolWhether the scene activates automatically when loaded (bundle scenes only).
Default: true
priorityuintScene loading priority (bundle scenes only).
Default: 100
progressionProgressionLoading progress callback.
Default: null

Returns

UniTask — an awaitable async operation. Generic overloads return UniTask<T>: an AsyncOperation for build scenes, a BundlePack for bundle scenes; the buildIndex overloads return UniTask<AsyncOperation>.

Description

The general-purpose async scene loading method with an explicit LoadSceneMode — the generalized form of LoadSingleSceneAsync / LoadAdditiveSceneAsync.

Example

using UnityEngine.SceneManagement;

// Get the BundlePack of a bundle scene generically
var pack = await CoreFrames.USFrame.LoadSceneAsync<BundlePack>("BattleScene", LoadSceneMode.Additive);

// Load by build index
var op = await CoreFrames.USFrame.LoadSceneAsync(1, LoadSceneMode.Single);

LoadSingleScene

public static void LoadSingleScene(string sceneName, Progression progression = null)
public static void LoadSingleScene(string packageName, string sceneName, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, Progression progression = null)

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
sceneNamestringScene name (supports the build# prefix).
localPhysicsModeLocalPhysicsModeLocal physics mode for the scene.
Default: LocalPhysicsMode.None
progressionProgressionLoading progress callback.
Default: null

Description

Loads a scene synchronously in Single mode. Behaves like LoadSingleSceneAsync (a warning is logged and nothing happens if a scene with the same name is already loaded).


LoadAdditiveScene

public static void LoadAdditiveScene(string sceneName, Progression progression = null)
public static void LoadAdditiveScene(string sceneName, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, bool activeRootGameObjects = true, Progression progression = null)
public static void LoadAdditiveScene(string packageName, string sceneName, Progression progression = null)
public static void LoadAdditiveScene(string packageName, string sceneName, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, bool activeRootGameObjects = true, Progression progression = null)

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
sceneNamestringScene name (supports the build# prefix).
localPhysicsModeLocalPhysicsModeLocal physics mode for the scene.
Default: LocalPhysicsMode.None
activeRootGameObjectsboolWhether to keep the scene's root objects active after loading.
Default: true
progressionProgressionLoading progress callback.
Default: null

Description

Loads a scene synchronously in Additive mode. Behaves like LoadAdditiveSceneAsync.


LoadMainAndSubScenes

public static void LoadMainAndSubScenes(string singleSceneName, AdditiveSceneInfo[] additiveSceneInfos, Progression progression = null)
public static void LoadMainAndSubScenes(string singleSceneName, LocalPhysicsMode localPhysicsMode, AdditiveSceneInfo[] additiveSceneInfos, Progression progression = null)
public static void LoadMainAndSubScenes(string packageName, string singleSceneName, AdditiveSceneInfo[] additiveSceneInfos, Progression progression = null)
public static void LoadMainAndSubScenes(string packageName, string singleSceneName, LocalPhysicsMode localPhysicsMode, AdditiveSceneInfo[] additiveSceneInfos, Progression progression = null)

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
singleSceneNamestringMain scene name (loaded in Single mode; supports the build# prefix).
localPhysicsModeLocalPhysicsModeLocal physics mode for the main scene.
Default: LocalPhysicsMode.None (overloads without it)
additiveSceneInfosAdditiveSceneInfo[]Sub-scene info array (see LoadMainAndSubScenesAsync for the fields).
progressionProgressionLoading progress callback (merged report).
Default: null

Description

The synchronous version of the combined main + sub scene loading. Behaves like LoadMainAndSubScenesAsync (a warning is logged and the flow aborts if the main scene is already loaded).


LoadSubScenes

public static void LoadSubScenes(AdditiveSceneInfo[] additiveSceneInfos, Progression progression = null)
public static void LoadSubScenes(string packageName, AdditiveSceneInfo[] additiveSceneInfos, Progression progression = null)

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
additiveSceneInfosAdditiveSceneInfo[]Sub-scene info array (see LoadMainAndSubScenesAsync for the fields).
progressionProgressionLoading progress callback (merged report).
Default: null

Description

Loads multiple Additive sub scenes synchronously in batch. Behaves like LoadSubScenesAsync.


LoadScene

public static void LoadScene(string sceneName, LoadSceneMode loadSceneMode, Progression progression = null)
public static void LoadScene(string packageName, string sceneName, LoadSceneMode loadSceneMode, Progression progression = null)
public static void LoadScene(string packageName, string sceneName, LoadSceneMode loadSceneMode, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, Progression progression = null)
public static Scene LoadScene(int buildIndex, LoadSceneMode loadSceneMode = LoadSceneMode.Single, Progression progression = null)
public static Scene LoadScene(int buildIndex, LoadSceneMode loadSceneMode = LoadSceneMode.Single, LocalPhysicsMode localPhysicsMode = LocalPhysicsMode.None, Progression progression = null)

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
sceneNamestringScene name (supports the build# prefix).
buildIndexintScene index in Build Settings (these overloads load from Build only).
loadSceneModeLoadSceneModeLoad mode (Single / Additive).
Default: LoadSceneMode.Single (buildIndex overloads)
localPhysicsModeLocalPhysicsModeLocal physics mode for the scene.
Default: LocalPhysicsMode.None
progressionProgressionLoading progress callback.
Default: null

Returns

The name-based overloads return nothing; the buildIndex overloads return Scene — the loaded scene (default when a scene with the same name is already loaded in Single mode).

Description

The general-purpose synchronous scene loading method with an explicit LoadSceneMode.


Unload

public static void Unload(bool recursively, params string[] sceneNames)
public static void Unload(bool recursively, params int[] buildIndexes)

Parameters

ParameterTypeDescription
recursivelyboolWhen true, unloads all scenes with the same name; when false, only the most recently loaded one.
sceneNamesparams string[]Scene names (supports the build# prefix; without it, the unload targets bundle scenes).
buildIndexesparams int[]Scene indexes in Build Settings (this overload unloads Build scenes only).

Description

Unloads the given scenes. Unloading bundle scenes goes through AssetLoader's reference counting; unloading build scenes uses SceneManager.UnloadSceneAsync.

Attention The last remaining scene cannot be unloaded (a warning is logged).

Example

// Unload the most recently loaded sub scene with this name
CoreFrames.USFrame.Unload(false, "EnvironmentScene");

// Unload all scenes with the same name (Build scenes)
CoreFrames.USFrame.Unload(true, "build#LightingScene");

CoreFrames.CPFrame

The unified Clone Prefab API. It is dedicated to managing small objects instantiated (cloned) from prefabs, such as drop items (first-aid kits, herbs, etc.), bullets, and UI template components (item icons, etc.). Their defining trait: when no longer needed, simply Destroy them — destroying an instance automatically unloads the asset through AssetLoader, keeping the reference count correct without any extra close call.

Method Overview

Initialization

MethodDescription
InitInstanceInitializes the CPManager singleton instance.

Preloading

MethodDescription
PreloadAsyncPreloads prefab assets into the cache asynchronously.
PreloadPreloads prefab assets into the cache synchronously.

Loading & Cloning

MethodDescription
LoadWithCloneAsync<T>Loads and clones a prefab asynchronously, returning a T instance.
LoadWithClone<T>Loads and clones a prefab synchronously, returning a T instance.

InitInstance

public static void InitInstance()

Description

Explicitly initializes the CPManager singleton instance (a plain C# singleton, not a MonoBehaviour). It is recommended to call this once during game startup.


PreloadAsync

public static async UniTask PreloadAsync(string assetName, uint priority = 0, Progression progression = null)
public static async UniTask PreloadAsync(string packageName, string assetName, uint priority = 0, Progression progression = null)
public static async UniTask PreloadAsync(string[] assetNames, uint priority = 0, Progression progression = null)
public static async UniTask PreloadAsync(string packageName, string[] assetNames, uint priority = 0, Progression progression = null)
public static async UniTask PreloadAsync<T>(string assetName, uint priority = 0, Progression progression = null) where T : UnityEngine.Object
public static async UniTask PreloadAsync<T>(string packageName, string assetName, uint priority = 0, Progression progression = null) where T : UnityEngine.Object
public static async UniTask PreloadAsync<T>(string[] assetNames, uint priority = 0, Progression progression = null) where T : UnityEngine.Object
public static async UniTask PreloadAsync<T>(string packageName, string[] assetNames, uint priority = 0, Progression progression = null) where T : UnityEngine.Object

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
assetNamestringPrefab asset name (bundle assets use their Address; supports the res# prefix).
assetNamesstring[]Array of prefab asset names (batch preloading).
priorityuintAsset loading priority.
Default: 0
progressionProgressionLoading progress callback.
Default: null

Returns

UniTask — an awaitable async operation.

Description

Loads prefab assets into the cache ahead of time (asset loading only — no instantiation), so a later LoadWithCloneAsync<T> call can use them immediately without a loading delay. The generic overloads let you specify the asset type to load (the non-generic overloads load as Object).

Example

// Preload the bullet prefab before entering battle
await CoreFrames.CPFrame.PreloadAsync("BulletCP");

// Preload in batch
await CoreFrames.CPFrame.PreloadAsync(new string[] { "BulletCP", "MedkitCP" });

Preload

public static void Preload(string assetName, Progression progression = null)
public static void Preload(string packageName, string assetName, Progression progression = null)
public static void Preload(string[] assetNames, Progression progression = null)
public static void Preload(string packageName, string[] assetNames, Progression progression = null)
public static void Preload<T>(string assetName, Progression progression = null) where T : UnityEngine.Object
public static void Preload<T>(string packageName, string assetName, Progression progression = null) where T : UnityEngine.Object
public static void Preload<T>(string[] assetNames, Progression progression = null) where T : UnityEngine.Object
public static void Preload<T>(string packageName, string[] assetNames, Progression progression = null) where T : UnityEngine.Object

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
assetNamestringPrefab asset name (bundle assets use their Address; supports the res# prefix).
assetNamesstring[]Array of prefab asset names (batch preloading).
progressionProgressionLoading progress callback.
Default: null

Description

The synchronous version of prefab preloading (without the priority parameter). Behaves like PreloadAsync.


LoadWithCloneAsync<T>

public static async UniTask<T> LoadWithCloneAsync<T>(string assetName, Transform parent = null, uint priority = 0, Progression progression = null) where T : CPBase, new()
public static async UniTask<T> LoadWithCloneAsync<T>(string packageName, string assetName, Transform parent = null, uint priority = 0, Progression progression = null) where T : CPBase, new()
public static async UniTask<T> LoadWithCloneAsync<T>(string assetName, Transform parent, bool worldPositionStays, uint priority = 0, Progression progression = null) where T : CPBase, new()
public static async UniTask<T> LoadWithCloneAsync<T>(string packageName, string assetName, Transform parent, bool worldPositionStays, uint priority = 0, Progression progression = null) where T : CPBase, new()
public static async UniTask<T> LoadWithCloneAsync<T>(string assetName, Vector3 position, Quaternion rotation, Transform parent = null, Vector3? scale = null, uint priority = 0, Progression progression = null) where T : CPBase, new()
public static async UniTask<T> LoadWithCloneAsync<T>(string packageName, string assetName, Vector3 position, Quaternion rotation, Transform parent = null, Vector3? scale = null, uint priority = 0, Progression progression = null) where T : CPBase, new()

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
assetNamestringPrefab asset name (bundle assets use their Address; supports the res# prefix).
parentTransformParent node to attach to.
Default: null
worldPositionStaysboolWhether to keep the world position when parenting (same semantics as Unity's Instantiate).
positionVector3Initial position of the instance.
rotationQuaternionInitial rotation of the instance.
scaleVector3?Initial scale of the instance.
Default: null (keeps the prefab's original scale)
priorityuintAsset loading priority.
Default: 0
progressionProgressionLoading progress callback.
Default: null

Returns

UniTask<T> — the cloned instance component; null when loading fails (asset not found) or no T component exists on the instance.

Description

Loads a prefab and instantiates (clones) it asynchronously. T must be the CPBase component (or a subclass) attached to the prefab root. After instantiation, OnCreateInitFirst (binding) → OnShow are triggered in order.

Attention
  • If the prefab root is active (true), OnShow is triggered automatically after cloning; if inactive, the instance stays deactivated and OnShow fires only after you call SetActive(true) yourself.
  • Every clone goes through the load counting, and the count is deducted automatically when the instance is destroyed.

Reminder When no longer needed, simply call Destroy(instance.gameObject) — the asset is unloaded automatically through AssetLoader.

Example

// Clone a bullet and attach it to the muzzle node
var bullet = await CoreFrames.CPFrame.LoadWithCloneAsync<BulletCP>("BulletCP", muzzle.transform);

// Clone a drop item at a specific position and rotation
var drop = await CoreFrames.CPFrame.LoadWithCloneAsync<DropItemCP>("MedkitCP", dropPos, Quaternion.identity);

// Done with it — just destroy (unloads automatically)
Object.Destroy(bullet.gameObject);

LoadWithClone<T>

public static T LoadWithClone<T>(string assetName, Transform parent = null, Progression progression = null) where T : CPBase, new()
public static T LoadWithClone<T>(string packageName, string assetName, Transform parent = null, Progression progression = null) where T : CPBase, new()
public static T LoadWithClone<T>(string assetName, Transform parent, bool worldPositionStays, Progression progression = null) where T : CPBase, new()
public static T LoadWithClone<T>(string packageName, string assetName, Transform parent, bool worldPositionStays, Progression progression = null) where T : CPBase, new()
public static T LoadWithClone<T>(string assetName, Vector3 position, Quaternion rotation, Transform parent = null, Vector3? scale = null, Progression progression = null) where T : CPBase, new()
public static T LoadWithClone<T>(string packageName, string assetName, Vector3 position, Quaternion rotation, Transform parent = null, Vector3? scale = null, Progression progression = null) where T : CPBase, new()

Parameters

ParameterTypeDescription
packageNamestringPackage name. If omitted, the default package is used.
assetNamestringPrefab asset name (bundle assets use their Address; supports the res# prefix).
parentTransformParent node to attach to.
Default: null
worldPositionStaysboolWhether to keep the world position when parenting (same semantics as Unity's Instantiate).
positionVector3Initial position of the instance.
rotationQuaternionInitial rotation of the instance.
scaleVector3?Initial scale of the instance.
Default: null (keeps the prefab's original scale)
progressionProgressionLoading progress callback.
Default: null

Returns

T — the cloned instance component; null when loading fails (asset not found) or no T component exists on the instance.

Description

The synchronous version of load-and-clone (without the priority parameter). Behaves like LoadWithCloneAsync<T>. Consider calling Preload beforehand to avoid hitches from synchronous loading.

Example

// With the asset preloaded, clone an item icon synchronously
var icon = CoreFrames.CPFrame.LoadWithClone<ItemIconCP>("ItemIconCP", iconRoot);