protected virtual void OnEnable()
 {
     if (!VRTK_SharedMethods.IsEditTime() && Application.isPlaying && defaultSnappedObject != null)
     {
         ForceSnap(defaultSnappedObject);
     }
 }
        protected virtual void CreateHighlightersInEditor()
        {
            //Only run if it's in the editor
            if (VRTK_SharedMethods.IsEditTime())
            {
                //Generate the main highlight object
                GenerateHighlightObject();

                //If a joint is being used but no joint is found then throw a warning in the console
                if (snapType == SnapTypes.UseJoint && GetComponent <Joint>() == null)
                {
                    VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "SnapDropZone:" + name, "Joint", "the same", " because the `Snap Type` is set to `Use Joint`"));
                }

                //Generate the editor highlighter object with the custom material
                GenerateEditorHighlightObject();

                //Ensure the game object references are force set based on whether they exist in the path
                ForceSetObjects();

                //Show the editor highlight object if it's set.
                if (highlightEditorObject != null)
                {
                    highlightEditorObject.SetActive(displayDropZoneInEditor);
                }
            }
        }
Exemplo n.º 3
0
        protected virtual void CreateHighlightersInEditor()
        {
            //Only run if it's in the editor
            if (VRTK_SharedMethods.IsEditTime())
            {
                //Generate the main highlight object
                GenerateHighlightObject();

                //If a joint is being used but no joint is found then throw a warning in the console
                if (snapType == SnapTypes.UseJoint && GetComponent <Joint>() == null)
                {
                    Debug.LogWarning("A Joint Component is required on the SnapDropZone GameObject called [" + name + "] because the Snap Type is set to `Use Joint`.");
                }

                //Generate the editor highlighter object with the custom material
                GenerateEditorHighlightObject();

                //Ensure the game object references are force set based on whether they exist in the path
                ForceSetObjects();

                //Show the editor highlight object if it's set.
                if (highlightEditorObject)
                {
                    highlightEditorObject.SetActive(displayDropZoneInEditor);
                }
            }
        }
Exemplo n.º 4
0
 private void Awake()
 {
     CreateInstance();
     if (!VRTK_SharedMethods.IsEditTime())
     {
         SetupControllers();
     }
 }
Exemplo n.º 5
0
 private void Awake()
 {
     CreateInstance();
     if (!VRTK_SharedMethods.IsEditTime())
     {
         SetupControllers();
         GetBoundariesSDK().InitBoundaries();
     }
 }
Exemplo n.º 6
0
 protected virtual void Awake()
 {
     CreateInstance();
     if (!VRTK_SharedMethods.IsEditTime())
     {
         SetupHeadset();
         SetupControllers();
         GetBoundariesSDK().InitBoundaries();
     }
 }
Exemplo n.º 7
0
        // Token: 0x06001B6A RID: 7018 RVA: 0x0008F540 File Offset: 0x0008D740
        private static void HandleSDKGetter <BaseType>(string prettyName, VRTK_SDKInfo info, IEnumerable <VRTK_SDKInfo> installedInfos) where BaseType : SDK_Base
        {
            if (VRTK_SharedMethods.IsEditTime())
            {
                return;
            }
            string sdkerrorDescription = VRTK_SDKSetup.GetSDKErrorDescription <BaseType>(prettyName, info, installedInfos);

            if (!string.IsNullOrEmpty(sdkerrorDescription))
            {
                VRTK_Logger.Error(sdkerrorDescription);
            }
        }
Exemplo n.º 8
0
 // Token: 0x06001225 RID: 4645 RVA: 0x00068AEC File Offset: 0x00066CEC
 protected virtual void ChooseDestroyType(Component deleteComponent)
 {
     if (VRTK_SharedMethods.IsEditTime())
     {
         if (deleteComponent != null)
         {
             Object.DestroyImmediate(deleteComponent);
             return;
         }
     }
     else if (deleteComponent != null)
     {
         Object.Destroy(deleteComponent);
     }
 }
Exemplo n.º 9
0
        private void CreateInstance()
        {
            if (instance == null)
            {
                instance = this;
            }
            else if (instance != this)
            {
                Destroy(gameObject);
            }

            if (persistOnLoad && !VRTK_SharedMethods.IsEditTime())
            {
                DontDestroyOnLoad(gameObject);
            }
        }
Exemplo n.º 10
0
 protected virtual void ChooseDestroyType(GameObject deleteObject)
 {
     if (VRTK_SharedMethods.IsEditTime())
     {
         if (deleteObject != null)
         {
             DestroyImmediate(deleteObject);
         }
     }
     else
     {
         if (deleteObject != null)
         {
             Destroy(deleteObject);
         }
     }
 }
Exemplo n.º 11
0
 protected virtual void ChooseDestroyType(Component deleteComponent)
 {
     if (VRTK_SharedMethods.IsEditTime())
     {
         if (deleteComponent)
         {
             DestroyImmediate(deleteComponent);
         }
     }
     else
     {
         if (deleteComponent)
         {
             Destroy(deleteComponent);
         }
     }
 }
Exemplo n.º 12
0
 private void ChooseDestroyType(GameObject deleteObject)
 {
     if (VRTK_SharedMethods.IsEditTime())
     {
         if (deleteObject)
         {
             DestroyImmediate(deleteObject);
         }
     }
     else
     {
         if (deleteObject)
         {
             Destroy(deleteObject);
         }
     }
 }
        protected virtual void CreateHighlightersInEditor()
        {
            if (VRTK_SharedMethods.IsEditTime())
            {
                GenerateHighlightObject();

                if (snapType == SnapTypes.UseJoint && GetComponent <Joint>() == null)
                {
                    VRTK_Logger.Warn(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "SnapDropZone:" + name, "Joint", "the same", " because the `Snap Type` is set to `Use Joint`"));
                }

                GenerateEditorHighlightObject();
                ForceSetObjects();
                if (highlightEditorObject != null)
                {
                    highlightEditorObject.SetActive(displayDropZoneInEditor);
                }
            }
        }
Exemplo n.º 14
0
        private void CreateInstance()
        {
            if (_instance == null)
            {
                _instance = this;

                string sdkErrorDescriptions = string.Join("\n- ", GetSimplifiedSDKErrorDescriptions());
                if (!string.IsNullOrEmpty(sdkErrorDescriptions))
                {
                    sdkErrorDescriptions = "- " + sdkErrorDescriptions;
                    Debug.LogError("There are some errors because of the current SDK Manager setup:\n" + sdkErrorDescriptions);
                }

                if (persistOnLoad && !VRTK_SharedMethods.IsEditTime())
                {
                    DontDestroyOnLoad(gameObject);
                }
            }
            else if (_instance != this)
            {
                Destroy(gameObject);
            }
        }
        protected virtual void OnEnable()
        {
            currentValidSnapInteractableObjects.Clear();
            currentSnappedObject       = null;
            objectToClone              = null;
            clonedObjectColliderStates = new bool[0];
            willSnap      = false;
            isSnapped     = false;
            wasSnapped    = false;
            isHighlighted = false;

#pragma warning disable 618
            if (defaultSnappedObject != null && defaultSnappedInteractableObject == null)
            {
                defaultSnappedInteractableObject = defaultSnappedObject.GetComponentInParent <VRTK_InteractableObject>();
            }
#pragma warning restore 618

            DisableHighlightShadows();
            if (!VRTK_SharedMethods.IsEditTime() && Application.isPlaying && defaultSnappedInteractableObject != null)
            {
                ForceSnap(defaultSnappedInteractableObject);
            }
        }
Exemplo n.º 16
0
        private void CreateInstance()
        {
            if (_instance == null)
            {
                _instance = this;
                VRTK_SDK_Bridge.InvalidateCaches();

                string sdkErrorDescriptions = string.Join("\n- ", GetSimplifiedSDKErrorDescriptions());
                if (!string.IsNullOrEmpty(sdkErrorDescriptions))
                {
                    sdkErrorDescriptions = "- " + sdkErrorDescriptions;
                    VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_MANAGER_ERRORS, new string[] { sdkErrorDescriptions }));
                }

                if (persistOnLoad && !VRTK_SharedMethods.IsEditTime())
                {
                    DontDestroyOnLoad(gameObject);
                }
            }
            else if (_instance != this)
            {
                Destroy(gameObject);
            }
        }