Ejemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        base.OnInspectorGUI();

        oldRelativePosition = relativePositionProp.vector3Value;
        oldAnchor           = (VRUIAnchor)anchorProp.intValue;

        if (m_target.HaveToUpdateRelativeValues)
        {
            UpdateRelativeValues();
        }

        DrawRelativePositionField();
        if (m_target.HasParentVRUIPositioner())
        {
            EditorGUILayout.Space();
            DrawAnchorDropdown();
        }
        serializedObject.ApplyModifiedProperties();

        if (oldRelativePosition != relativePositionProp.vector3Value && !m_target.HaveToUpdateRelativeValues)
        {
            m_target.SetPositionRelativeToAnchor();
            m_target.SetupAnchor();
        }
        if (oldAnchor != (VRUIAnchor)anchorProp.intValue)
        {
            m_target.SetupAnchor();
        }
        PrefabUtility.RecordPrefabInstancePropertyModifications(m_target.gameObject);
    }