Attributes

Table of Content

Table of Content

Table of Content

Draw in Rect

This attribute allows you to link a GUI function to draw in place of your variable.

It requires a string corresponding to the drawing function and can take an int parameter corresponding to the desired height (default value 30).

using MVsToolkit.Dev;



    [DrawInRect("DrawRedSquare", 30)] 
    public int drawRedSquare;

#if UNITY_EDITOR
    void DrawRedSquare(Rect rect)
    {
        EditorGUI.DrawRect(rect, Color.red);
    }

Require namespace MVsToolkit.Dev

The variable must be serialized (Serializefield, public).

The function must take a Rect parameter.

The function must be included in “#if UNITY_EDITOR” to be compiled during build.

Create a free website with Framer, the website builder loved by startups, designers and agencies.