Skip to content

LaiYizhou/Unity-Utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity-Utils

A micro collection of unity3d utils for me and by me.


  • DataStructures

    It contains heap

    Note:

    MinHeap<int[]> minHeap = new MinHeap<int[]>(Comparer<int[]>.Create((a, b) => { return a[0] - b[0];}));

    it can work in .NET 4.8 but can't work in some Unity Editor

  • LogUtil

  • TimeUtil

    It can check daily function, such as daily login, daily bonus, daily puzzle

    eg:

    int CheckDaily(DateTime now, DateTime last)
    bool IsNewDay(DateTime now, DateTime last)

  • BitUtil

    It's about bit operation

    eg:

    int SetBit(this int A, int k, bool val)
    bool GetBit(this int A, int k)
    string ToBinaryString(this int A, char sep = ',')

  • LINQUtil

    It's extension based on LINQ

    eg:

    string ToOneLineString()
    T RandomOne<T>()
    T RandomSome<T>()

  • EditorButton

    It can add buttons in Inspector panel in Unity3D with attribute.

    eg:

    public class Test : MonoBehaviour
    {
        [Button]
        public void PrintName()
        {
            Debug.Log(name);
        }
    }

    20190710172035

  • EditorRename

    It can rename the field which showed in Inspector panel.

    eg:

    public enum EColor
    {
        [Rename("红色")]
        A,
        [Rename("黄色")]
        B,
        [Rename("蓝色")]
        C
    }
    
    public class Test : MonoBehaviour
    {
        [Rename("年龄")]
        public int Age;
    
        [Rename("颜色")]
        [SerializeField]
        private EColor color;
    }

    20190710172255