public void OnEnable()
    {
        LightProbesTetrahedralGrid grid = target as LightProbesTetrahedralGrid;

        if (grid)
        {
            grid.Generate();
        }
    }
    public override void OnInspectorGUI()
    {
        EditorGUI.BeginChangeCheck();
        base.OnInspectorGUI();

        if (EditorGUI.EndChangeCheck())
        {
            LightProbesTetrahedralGrid grid = target as LightProbesTetrahedralGrid;
            if (grid)
            {
                grid.Generate();
            }
        }
    }
    public void OnSceneGUI()
    {
        LightProbesTetrahedralGrid grid = target as LightProbesTetrahedralGrid;

        if (!grid)
        {
            return;
        }

        Handles.color = Color.yellow;
        Handles.DrawWireDisc(grid.transform.position, grid.transform.up, grid.m_Radius);
        Handles.DrawWireDisc(grid.transform.position + grid.transform.up * grid.m_Height, grid.transform.up, grid.m_Radius);


        float oldRadius = grid.m_Radius;
        float radius    = oldRadius;

        radius = DrawSlider(grid.transform.position, grid.transform.right, radius);
        radius = DrawSlider(grid.transform.position, -grid.transform.right, radius);
        radius = DrawSlider(grid.transform.position, grid.transform.forward, radius);
        radius = DrawSlider(grid.transform.position, -grid.transform.forward, radius);

        float oldHeight = grid.m_Height;
        float height    = oldHeight;

        height = DrawSlider(grid.transform.position + grid.transform.right * radius, grid.transform.up, height);
        height = DrawSlider(grid.transform.position - grid.transform.right * radius, grid.transform.up, height);
        height = DrawSlider(grid.transform.position + grid.transform.forward * radius, grid.transform.up, height);
        height = DrawSlider(grid.transform.position - grid.transform.forward * radius, grid.transform.up, height);

        if (radius != oldRadius || height != oldHeight)
        {
            grid.m_Radius = radius;
            grid.m_Height = height;
            grid.OnValidate();
            grid.Generate();
        }
    }