Skip to content

Lightweight MyBox is a set of attributes, tools and extensions for Unity.

License

Notifications You must be signed in to change notification settings

michael811125/LWMyBox

This branch is 27 commits ahead of, 100 commits behind Deadcows/MyBox:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

42b3436 · Mar 29, 2024
Feb 16, 2024
Aug 17, 2023
Feb 16, 2024
Feb 6, 2024
Aug 26, 2018
Feb 16, 2024
Aug 15, 2019
Aug 26, 2018
Aug 24, 2018
Aug 26, 2018
Aug 16, 2023
Jan 24, 2019
Feb 16, 2024
Aug 26, 2018
Aug 26, 2018
Feb 6, 2024
Mar 29, 2024
Aug 11, 2019

Repository files navigation

LWMyBox (Lightweight MyBox)

Keep only commonly used attributes, improve Unity Editor compilation efficiency.

Partial reference to NaughtyAttributes


Install via git URL

Add https://github.com/michael811125/LWMyBox.git to Package Manager


Preview

screenshot_01

screenshot_02


ButtonClicker

screenshot_06

[CreateAssetMenu]
public class OuterClass : ScriptableObject
{
    [Serializable]
    public class InnerClass
    {
        // InnerClass ButtonClicker
        [ButtonClicker(typeof(InnerClass), "innerClass", nameof(InnerClassMethod), "Print InnerClass Value", "#4df3ff")]
        public bool invoke;
        public int value = 20;

        public void InnerClassMethod()
        {
            Debug.Log($"[InnerClass] Value is {this.value}");
        }
    }

    // Instance innerClass and value name is "innerClass"
    public InnerClass innerClass = new InnerClass();
    public int value = 10;

    [ButtonMethod("Print OuterClass Value", "#ff4dc2")]
    public void OuterClassMethod()
    {
        Debug.Log($"[OuterClass] Value is {this.value}");
    }
}

ButtonMethod

screenshot_03

    [ButtonMethod("Test Button Method 1 (Click Me)")]
    private void _TestButtonMethod1()
    {
        Debug.Log("Yes, click me 1 !!!");
    }

    [ButtonMethod("Test Button Method 2 (Click Me)", "#3bff8c")]
    private void _TestButtonMethod2()
    {
        Debug.Log("Yes, click me 2 !!!");
    }

ShowAssetPreview

screenshot_07

    [ShowAssetPreview]
    public GameObject previewGo;

    [ShowAssetPreview(TextAnchor.MiddleCenter)]
    public Material previewMat1;

    [ShowAssetPreview(128, 128, TextAnchor.MiddleLeft)]
    public Material previewMat2;

ProgressBar

screenshot_05

    [ProgressBar("Health", 500)]
    public int health = 250;

    [ProgressBar("Energy", 500, "#ffcc42")]
    public float energy = 440;

    [ProgressBar("Magic", nameof(maxMagic), "#c660ff")]
    public float magic = 150;
    public float maxMagic = 336;

CurveRange

screenshot_04

    [CurveRange("#ff00d9")]
    public AnimationCurve curve1;

    [CurveRange(0f, 0f, 1f, 1f, "#3bff8c")]
    public AnimationCurve curve2;

Separator

screenshot_08

    [Separator("GameObject / Component")]
    public Transform Target;
    [ConditionalField(nameof(Target))] public float TargetSpeed;
    [ConditionalField(nameof(Target), inverse: true)] public float Speed;

    [Separator("Bool", "#acff5a", 1.25f)]
    public bool Teleport;
    [ConditionalField(nameof(Teleport))] public float TeleportationDelay;

    [Separator("String")]
    public string Hello;
    [ConditionalField(nameof(Hello), false, "Hello")] public string HelloWorld = "World! :)";
    [ConditionalField(nameof(Hello))] public string HelloHint = "Print \"Hello\"!";

    [Separator(2, "#e2ff5a")]
    public AIState State = AIState.None;
    [ConditionalField(nameof(State), false, AIState.Walk)] public float WalkSpeed;
    [ConditionalField(nameof(State), false, AIState.Idle)] public float IdleTime;

Testing

Compiled and tested


Reference

If you have complete requirements and documentation, please support the original author. (MyBox)

About

Lightweight MyBox is a set of attributes, tools and extensions for Unity.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%