Exemple #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);
    }
Exemple #2
0
    static void ResetPosition(MenuCommand command)
    {
        VRUIPositioner target = (VRUIPositioner)command.context;

        Undo.RecordObjects(new Object[] { target, target.transform }, STRING_RESET_POSITION_UNDO);
        target.RelativePosition = Vector3.zero;
        target.SetPositionRelativeToAnchor();
    }