Lemmings
Remappable Gestures For Unity
Loading...
Searching...
No Matches
Lemmings.LemmingUtils Class Reference

Utility class providing structural and scene-based helpers for working with Lemmings. Includes path resolution, transform tracking, and fallback object retrieval. More...

Static Public Member Functions

static bool HasValidShepherd (this ILemming lemming)
 Checks if the given ILemming's GameObject is a descendant of a valid LemmingShepherd. This is called because without a Shepherd the Lemming does not stay present from Scene to Scene. In other words, this is required for the Lemmings to be accessible in menus and other areas.
static string GetTransformPath (Transform transform)
 Builds a stable, slash-separated path to the given transform from the scene root. Example: "Root/Body/Hand/Lemming_A".
static GameObject ResolveSceneObject (string path, string fallbackName=null)
 Attempts to find a GameObject in the active scene using a slash-separated transform path. Falls back to searching by GameObject name if the path is not found. TODO: This needs more robustness to account for moved items and name changes.
static GameObject GetOrResolve (ref GameObject cached, ref string path, string fallbackName=null)
 Retrieves a GameObject reference from a stored field or resolves it from a path if null. If successfully resolved, the current path reference will be updated to reflect any new structure.

Detailed Description

Utility class providing structural and scene-based helpers for working with Lemmings. Includes path resolution, transform tracking, and fallback object retrieval.

Member Function Documentation

◆ GetOrResolve()

GameObject Lemmings.LemmingUtils.GetOrResolve ( ref GameObject cached,
ref string path,
string fallbackName = null )
inlinestatic

Retrieves a GameObject reference from a stored field or resolves it from a path if null. If successfully resolved, the current path reference will be updated to reflect any new structure.

Parameters
cachedReference to the current (possibly null) GameObject.
pathReference to the path string, which will be updated if a new object is resolved.
fallbackNameOptional fallback name used if path fails.
Returns
The resolved GameObject, or null if not found.

◆ GetTransformPath()

string Lemmings.LemmingUtils.GetTransformPath ( Transform transform)
inlinestatic

Builds a stable, slash-separated path to the given transform from the scene root. Example: "Root/Body/Hand/Lemming_A".

Parameters
transformThe transform to generate the path for.
Returns
A string path from root to the transform.

◆ ResolveSceneObject()

GameObject Lemmings.LemmingUtils.ResolveSceneObject ( string path,
string fallbackName = null )
inlinestatic

Attempts to find a GameObject in the active scene using a slash-separated transform path. Falls back to searching by GameObject name if the path is not found. TODO: This needs more robustness to account for moved items and name changes.

Parameters
pathThe transform path string (e.g., "Root/Body/Hand/Lemming_A").
fallbackNameOptional fallback name to search by if path fails.
Returns
The GameObject found, or null if not found.

The documentation for this class was generated from the following file:
  • Assets/Lemmings/Scripts/Namespace/LemmingUtilities.cs