SuperBehaviour SuperBehaviour
SuperBehaviour SuperBehaviour
v0.1.2 [Beta]

Search Results for

    Namespace LoM.Super

    Included in the base framework

    This namespace is the base for all Super Frameworks and Plugins.
    Should be included in all Scripts in the Project.

    Classes

    ButtonAttribute

    Attribute to specify a inspector Button before or after a field, property or method.

    ConditionAttribute

    Attribute to specify conditions for a field or property.
    NOTE: Use this to create your own custom conditions.

    EditableIfAttribute

    Attribute to make a field editable if a condition is met.
    Note: If the target field is a bool it will check for true/false, otherwise it will check if the field is not null.


    [SerializeField] private bool m_UseFeature;
    [SerializeField, EditableIf("m_UseFeature")] private Transform m_ObjectReference; // Will only be editable if m_UseFeature is true.

    HDRColorAttribute

    Attribute to mark a field as a HDR color.

    LabelAttribute

    Attribute to specify a custom label for a field or property.

    LayerAttribute

    Use this attribute to make a field a layer field.
    Only works on int fields.

    LazySingletonBehaviour<T>

    A singleton MonoBehaviour that inherits from SuperBehaviour.
    NOTE: This will create a new instance if one does not exist.

    See SingletonBehaviour<T> for more information on how to use this class.

    PropertyHDRColorAttribute

    Attribute to make a field be drawn as HDR color field.

    PropertyHeaderAttribute

    Attribute to specify a header for a property. Is drawn above the property.

    PropertyLayerAttribute

    Attribute to make a property a layer field. Only works on int fields.

    PropertyRangeAttribute

    Attribute to specify a range for a property. Only works for float and int.

    PropertySpaceAttribute

    Use this attribute to add a space between properties in the inspector.

    PropertyTagAttribute

    Use this attribute to make a field a tag field. Only works on string fields.

    PropertyTextAreaAttribute

    Attribute to make a field be drawn as a text area. Only works on string fields.


    [PropertyTextArea(3, 10)]
    public string text;

    PropertyTooltipAttribute

    Attribute to specify a tooltip for a property.

    ReadOnlyAttribute

    Use this attribute to make a field read-only in the inspector.

    SerializePropertyAttribute

    Use this attribute to enable properties to be shown like fields in the inspector.
    WARNING: This does NOT serialize or save the property in any way.

    Due to to the limition mentioned above the attributes are only editable in the play mode.
    Any changes made to the properties in edit mode will not be saved.


    If you assign this attribute to a property with a private or protected setter, it will be shown in the inspector as a readonly field.
    [SerializeProperty]
    public int PlayerHealth => m_PlayerHealth;
    If you assign this attribute to a property with a public setter, it will be shown in the inspector as a normal field.
    NOTE: It will still not be editable in edit mode.
    [SerializeProperty]
    public int PlayerHealth { get; set; }

    ShowIfAttribute

    Attribute to show or hide a field based on a condition.
    Note: If the target field is a bool it will check for true/false, otherwise it will check if the field is not null.


    [SerializeField] private bool m_UseFeature;
    [SerializeField, ShowIf("m_UseFeature")] private Transform m_ObjectReference; // Will only be visible if m_UseFeature is true.

    SingletonBehaviour<T>

    A singleton MonoBehaviour that inherits from SuperBehaviour.
    Implements a thread-safe singleton pattern as a inheritable base class.


    To create a singleton MonoBehaviour, simply inherit from SingletonBehaviour and add the generic type parameter of the class itself.
    public class GameManager : SingletonBehaviour<GameManager> 
    {
       // ...
    }
    For a hierarchy of singleton classes, use a generic type parameter T in the base class and inherit from SingletonBehaviour.
    This approach ensures that each subclass (GameManager, UIManager, etc.) functions as a singleton, inheriting the singleton behavior from the base Manager class.
    // Base class with generic type parameter T for singleton management
    public class Manager<T> : SingletonBehaviour<T> where T : SuperBehaviour { }
    

    // Derived singleton classes public class GameManager : Manager<GameManager> { } public class UIManager : Manager<UIManager> { }


    SuperBehaviour

    SuperBehaviour is a MonoBehaviour that provides some additional functionality.
    It provides a cached version of the transform and gameObject properties.
    It also enables the use of SuperEditor and SerializedProperties.

    SuperIcon

    Attribute to specify an icon for a SuperBehaviour.
    Note: Use the SuperBehaviourIcon enum to specify the icon or use a custom path.


    [SuperIcon(SuperBehaviourIcon.GameManager)]
    public class GameManager : SuperBehaviour { }

    SuperRectTransform

    Represents a UGUI RectTransform
    This class is used to simplify the access to the RectTransform of a UGUI GameObject, it provides a more intuitive way to access the RectTransform properties as they behave exactly like in the Inspector.


    To use the SuperRectTransform, simply cast the RectTransform to a SuperRectTransform and or use the AsSuperRectTransform extension method.
    // Stretch All
    SuperRectTransform transform = GetComponent<RectTransform>();
    transform.Left = 10;
    transform.Right = 10;
    transform.Bottom = 10;
    transform.Top = 10;
    

    // Center SuperRectTransform transform = GetComponent<RectTransform>(); transform.PosX = 10; transform.PosY = 10; transform.Width = 100; transform.Height = 100;


    TabsAttribute

    Use this attribute to make a field a tag field. Only works on Enum fields.

    TagAttribute

    Use this attribute to make a field a tag field. Only works on string fields.

    UGUIAnchorExtensions
    UGUIExtensions

    Enums

    SuperBehaviourIcon

    Enum to specify an icon for a SuperBehaviour

    UGUIAnchor

    Represents the anchor of a RectTransform as shown in the Inspector

    © Lords of Mahlstrom Gaming, all rights reserved.