Game.Prefabs.StackDirection
Assembly:
Assembly-CSharp (game assembly)
Namespace:
Game.Prefabs
Type:
public enum
Base:
System.Enum
Summary:
Enum used by prefab-related systems to express a stacking direction for prefabs or elements derived from a prefab. It defines the canonical directions that the game code can use when arranging or offsetting stacked items (for example when placing repeated elements, stacking props, or determining neighbor placement along an axis). Values are the default integer-backed enum values (None = 0, Right = 1, Up = 2, Forward = 3).
Fields
-
None
Represents no stacking direction / not applicable. Numeric value: 0. Use when no offset or stacking should be applied. -
Right
Represents the +X / "right" direction relative to the prefab or world. Numeric value: 1. Commonly used to indicate stacking or placement to the right of an element. -
Up
Represents the +Y / "up" direction. Numeric value: 2. Used for vertical stacking. -
Forward
Represents the +Z / "forward" direction. Numeric value: 3. Used to indicate stacking or placement in front/forward of an element.
Properties
- This enum does not declare any custom properties. It has the standard System.Enum behavior (value, ToString(), etc.).
Constructors
- Enums do not declare explicit constructors in source code. Instances are created by assigning enum values (e.g., StackDirection.Right).
Methods
- No methods are declared on this enum. Standard methods inherited from System.Enum/System.ValueType/Object apply (ToString, GetHashCode, Equals, etc.).
Usage Example
using UnityEngine;
using Game.Prefabs;
public static Vector3 GetStackOffset(StackDirection dir, float distance)
{
return dir switch
{
StackDirection.Right => Vector3.right * distance,
StackDirection.Up => Vector3.up * distance,
StackDirection.Forward => Vector3.forward * distance,
_ => Vector3.zero, // StackDirection.None or unknown
};
}
// Example usage:
StackDirection dir = StackDirection.Right;
Vector3 offset = GetStackOffset(dir, 2.0f);
// offset will be (2, 0, 0)