public static void RigidbodyInspectorGUI(RigidbodyProperty rigidbodyProperty)
    {
        if (rigidbodyProperty == null)
        {
            return;
        }

        bool enabled = GUI.enabled;

        rigidbodyProperty.isCreate = EditorGUILayout.Toggle("Is Create", rigidbodyProperty.isCreate);
        GUI.enabled = enabled && rigidbodyProperty.isCreate;
        rigidbodyProperty.isKinematic  = EditorGUILayout.Toggle("Is Kinematic", rigidbodyProperty.isKinematic);
        rigidbodyProperty.viewAdvanced = EditorGUILayout.Foldout(rigidbodyProperty.viewAdvanced, "Advanced");

        if (rigidbodyProperty.viewAdvanced)
        {
            rigidbodyProperty.mass                   = EditorGUILayout.FloatField("Mass", rigidbodyProperty.mass);
            rigidbodyProperty.drag                   = EditorGUILayout.FloatField("Drag", rigidbodyProperty.mass);
            rigidbodyProperty.angularDrag            = EditorGUILayout.FloatField("Angular Drag", rigidbodyProperty.mass);
            rigidbodyProperty.useGravity             = EditorGUILayout.Toggle("Use Gravity", rigidbodyProperty.useGravity);
            rigidbodyProperty.interpolation          = (RigidbodyInterpolation)EditorGUILayout.EnumPopup("Interpolation", rigidbodyProperty.interpolation);
            rigidbodyProperty.collisionDetectionMode = (CollisionDetectionMode)EditorGUILayout.EnumPopup("Collision Detection Mode", rigidbodyProperty.collisionDetectionMode);
        }

        GUI.enabled = enabled;
    }
    //--------------------------------------------------------------------------------------------------------

    public static void AddRigidbody(GameObject gameObject, RigidbodyProperty rigidbodyProperty)
    {
        if (gameObject == null || rigidbodyProperty == null)
        {
            Debug.LogError("");
            return;
        }

        if (rigidbodyProperty.isCreate)
        {
            Rigidbody rigodbody = gameObject.AddComponent <Rigidbody>();

            if (rigodbody == null)
            {
                rigodbody = gameObject.GetComponent <Rigidbody>();
            }

            if (rigodbody != null)
            {
                rigodbody.mass                   = rigidbodyProperty.mass;
                rigodbody.drag                   = rigidbodyProperty.drag;
                rigodbody.angularDrag            = rigidbodyProperty.angularDrag;
                rigodbody.isKinematic            = rigidbodyProperty.isKinematic;
                rigodbody.useGravity             = rigidbodyProperty.useGravity;
                rigodbody.interpolation          = rigidbodyProperty.interpolation;
                rigodbody.collisionDetectionMode = rigidbodyProperty.collisionDetectionMode;
            }
        }
    }