Skip to content

PlayerLoopUtility

Namespace: SideXP.Core

public static class PlayerLoopUtility

Miscellaneous utility functions and extensions for working with PlayerLoop system.

See also

-

Methods

InsertSubsystem<T>(PlayerLoopSystem, int, bool)

public static bool InsertSubsystem<T>(in PlayerLoopSystem system, int index = -1, bool skipApply = false)

Inserts a given Player Loop subsystem as child of a given system type.

Type parameters

  • T: The type of the system to which the given system will be added as a child.

Parameters

  • system: The subsystem to add as child of the given system type.
  • index: The index at which to insert the subsystem in the list. If negative or out of bounds, add the subsystem at the end of the list.
  • skipApply: By default, this function will apply the changes by calling SetPlayerLoop after the system is inserted successfully. If enabled, you must call that function by yourself to apply the changes.

Returns

Returns true if the subsystem has been inserted successfully.

Remarks

This overload will search for the expected system type from the current Player Loop. Also, it will apply changes automatically by calling SetPlayerLoop after the system is inserted successfully, and if skipApply is disabled.

InsertSystemInto<T>(PlayerLoopSystem, PlayerLoopSystem, int)

public static bool InsertSystemInto<T>(ref PlayerLoopSystem from, in PlayerLoopSystem system, int index = -1)

Inserts a given Player Loop subsystem as child of a given system type.

Type parameters

  • T: The type of the system to which the given system will be added as a child.

Parameters

  • from: The system from which to search for the expected subsystem type.
  • system: The subsystem to add as child of the given system type.
  • index: The index at which to insert the subsystem in the list. If negative or out of bounds, add the subsystem at the end of the list.

Returns

Returns true if the subsystem has been inserted successfully.

Remarks

This overload won't apply the Player loop changes: you must call SetPlayerLoop to do so.

RemoveSubsystem<T>(bool)

public static bool RemoveSubsystem<T>(bool skipApply = false)

Removes all subsystems of a given system type from the current Player Loop.

Type parameters

  • T: The type of the system to remove.

Parameters

  • skipApply: By default, this function will apply the changes by calling SetPlayerLoop if a system has been removed successfully. If enabled, you must call that function by yourself to apply the changes.

Returns

Returns true if a subsystem has been removed successfully.

Remarks

This overload will search for the expected system type from the current Player Loop. Also, it will apply changes automatically by calling SetPlayerLoop if a system has been removed successfully, and if skipApply is disabled.

RemovePlayerLoop<T>(PlayerLoopSystem)

public static bool RemovePlayerLoop<T>(ref PlayerLoopSystem from)

Removes all subsystems of a given system type from the current Player Loop.

Type parameters

  • T: The type of the system to remove.

Parameters

  • from: The system from which to search for the expected subsystem type.

Returns

Returns true if a subsystem has been removed successfully.

Remarks

This overload won't apply the Player loop changes: you must call SetPlayerLoop to do so.

PrintPlayerLoop()

public static void PrintPlayerLoop()

Logs a message in console that displays the full subsystems hierarchy of the current Player Loop.

PrintPlayerLoop(PlayerLoopSystem)

public static void PrintPlayerLoop(in PlayerLoopSystem system)

Logs a message in console that displays the full subsystems hierarchy from a given system.

Parameters

  • system: The system from which to display the subsystems hierarchy.