private void ChangeManipulationType(ManipulationMode manipulationMode)
 {
     if (gameObject == ObjectStateManager.Instance.SelectedObject)
     {
         SpatialManipulator spatialManipulator = GetManipulator();
         if (spatialManipulator == null)
         {
             return;
         }
         if (spatialManipulator.Mode != manipulationMode)
         {
             if (manipulationMode == ManipulationMode.NONE)
             {
                 spatialManipulator.ResetPosition();
                 return;
             }
             spatialManipulator.Mode = manipulationMode;
             Debug.Log("NEW manipulation mode: " + spatialManipulator.Mode);
         }
     }
     else
     {
         Debug.Log("This object is currently not selected!");
     }
 }
    private SpatialManipulator GetManipulator(GameObject selectedObject)
    {
        if (selectedObject == null)
        {
            return(null);
        }
        SpatialManipulator spatialManipulator = selectedObject.GetComponent <SpatialManipulator>();

        return(spatialManipulator);
    }
 public void OnNavigationUpdated(NavigationEventData eventData)
 {
     if (mSelectedObject != null)
     {
         SpatialManipulator spatialManipulator = GetManipulator(SelectedObject);
         if (spatialManipulator != null)
         {
             spatialManipulator.Manipulate(eventData.CumulativeDelta, ManipulationDataType.NAVIGATION_DATA);
         }
     }
 }
    private SpatialManipulator GetManipulator()
    {
        //var lastSelectedObject = ObjectStateManager.Instance.SelectedObject;

        /*if (lastSelectedObject == null)
         * {
         *  Debug.Log("No selected element found");
         *  return null;
         * }*/
        //var manipulator = lastSelectedObject.GetComponent<SpatialManipulator>();
        SpatialManipulator manipulator = GetComponent <SpatialManipulator>();

        if (manipulator == null)
        {
            //manipulator = lastSelectedObject.GetComponentInChildren<SpatialManipulator>();
            manipulator = GetComponentInChildren <SpatialManipulator>();
        }

        if (manipulator == null)
        {
            Debug.Log("No manipulator component found");
        }
        return(manipulator);
    }