Skip to content

Utilities

chaolun edited this page Aug 14, 2019 · 2 revisions

Ranged Int and Ranged Float

you can use RangedInt or RangedFloat like :

public class Example
{
    [MinMaxRange (0, 10)]
    public RangedInt a;
    [MinMaxRange (0, 10)]
    public RangedFloat b;
}

Then you just need drag the slider to select the range in Inspector Window

UILineRenderer

You can add this component to the RectTransform component, Then you can draw ui line by setting properties such as color, points...

You also can add it use Inspector -> Add Component -> UI -> UILineRenderer

private UILineRenderer uiLineRenderer;

void Start()
{
    uiLineRenderer = this.GetComponent<UILineRenderer>();
    uiLineRenderer.Points = new Vector2[2];
}

void Update()
{
    uiLineRenderer.Points[0] = new Vector3(Time.time, 0, 0);
    uiLineRenderer.Points[1] = new Vector3(0, Time.time, 0);
    // Don't forget to call the following method or line won't be redrawn
    uiLineRenderer.SetVerticesDirty();
}

Distortion (UI Effect)

You can add this component to the Text component, Then you can adjust the animation curve in the Inspector Window to change the shape of the Text text

You also can add it use Inspector -> Add Component -> UI -> Effects -> Distortion

Circular (UI Effect)

You can add this component to Image, then you can adjust the params in the Inspector Window to change the shape of the image

You also can add it use Inspector -> Add Component -> UI -> Effects -> Circular

The shape of an image can be easily transformed into a circle, a sector, a ring

Restructure EasyAsset(ScriptableObject)

Now you can code a ScriptableObject eg. EasyBlock : EasyAsset<string, Blockobject>

Then you can use ScriptableObject Window to create it

I also Add EasyBlock you can right click Hierarchy gameObject Select UniEasy -> Export Block or Export Block Group to export preference

The structure of the exported blocks needs to meet the following conditions

BlockGroup(GameObject) [Right Click Export Block Group]

  Block0(GameObject) [Right Click Export Block]

    Cube0(Prefab)
    Cube1(Prefab)
    ...  (Prefab)

  Block1(GameObject) [Right Click Export Block]

    Cube0(Prefab)
    Cube1(Prefab)
    ...  (Prefab)

PrefabsUtility

Selected all you want to apply changes prefabs in the Hierarchy, then right click select UniEasy -> Apply Changes To Selected Prefabs or click the GameObject -> Apply Changes To Selected Prefabs button on the menu bar

Selected all you want to revert changes prefabs in the Hierarchy, then right click select UniEasy -> Revert Changes Of Selected Prefabs or click the GameObject -> Revert Changes Of Selected Prefabs button on the menu bar

FormatUtility

Selected all you want to format gameObjects in the Hierarchy, then right click select UniEasy -> Format Selected GameObjects Name or click the GameObject -> Format Selected GameObjects Name button on the menu bar

Clone this wiki locally