public override void OnInspectorGUI()
            {
                base.OnInspectorGUI();

                UIParticles uiParticleSystem = (UIParticles)target;

                if (GUILayout.Button("Apply to nested particle systems"))
                {
                    var nested = uiParticleSystem.gameObject.GetComponentsInChildren <ParticleSystem>();
                    foreach (var particleSystem in nested)
                    {
                        if (particleSystem.GetComponent <UIParticles>() == null)
                        {
                            particleSystem.gameObject.AddComponent <UIParticles>();
                        }
                    }
                }

                EditorGUILayout.PropertyField(m_RenderMode);

                if (uiParticleSystem.RenderMode == UiParticleRenderMode.StreachedBillboard)
                {
                    EditorGUILayout.PropertyField(m_StretchedSpeedScale);
                    EditorGUILayout.PropertyField(m_StretchedLenghScale);
                }

                if (uiParticleSystem.RenderMode == UiParticleRenderMode.Mesh)
                {
                    EditorGUILayout.PropertyField(m_RenderedMesh);
                }

                EditorGUILayout.PropertyField(m_IgnoreTimescale);
                serializedObject.ApplyModifiedProperties();
            }
    private static int Stop(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 1);
            UIParticles uIParticles = (UIParticles)ToLua.CheckObject(L, 1, typeof(UIParticles));
            uIParticles.Stop();
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
    private static int set_IsForward(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIParticles uIParticles = (UIParticles)obj;
            bool        isForward   = LuaDLL.luaL_checkboolean(L, 2);
            uIParticles.IsForward = isForward;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index IsForward on a nil value");
        }
        return(result);
    }
    private static int set_parentWidget(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIParticles uIParticles  = (UIParticles)obj;
            UIWidget    parentWidget = (UIWidget)ToLua.CheckUnityObject(L, 2, typeof(UIWidget));
            uIParticles.parentWidget = parentWidget;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index parentWidget on a nil value");
        }
        return(result);
    }
    private static int set_RenderQueue(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIParticles uIParticles = (UIParticles)obj;
            int         renderQueue = (int)LuaDLL.luaL_checknumber(L, 2);
            uIParticles.RenderQueue = renderQueue;
            result = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index RenderQueue on a nil value");
        }
        return(result);
    }
    private static int get_parentWidget(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIParticles uIParticles  = (UIParticles)obj;
            UIWidget    parentWidget = uIParticles.parentWidget;
            ToLua.Push(L, parentWidget);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index parentWidget on a nil value");
        }
        return(result);
    }
    private static int get_RenderQueue(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UIParticles uIParticles = (UIParticles)obj;
            int         renderQueue = uIParticles.RenderQueue;
            LuaDLL.lua_pushinteger(L, renderQueue);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index RenderQueue on a nil value");
        }
        return(result);
    }
    private static int SetParticleRotation(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 4);
            UIParticles uIParticles = (UIParticles)ToLua.CheckObject(L, 1, typeof(UIParticles));
            float       x           = (float)LuaDLL.luaL_checknumber(L, 2);
            float       y           = (float)LuaDLL.luaL_checknumber(L, 3);
            float       z           = (float)LuaDLL.luaL_checknumber(L, 4);
            uIParticles.SetParticleRotation(x, y, z);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }