コード例 #1
0
        private void OnEnable()
        {
            manager = (InputManagerNew)target;
            manager.RefreshInputMappings();

            SerializedProperty interactor = serializedObject.FindProperty("interactor");
            SerializedProperty grabMap    = serializedObject.FindProperty("grabMap");

            if (interactor.objectReferenceValue == null)
            {
                InteractorRaw _interactor = null;

                _interactor = manager.GetComponent <InteractorRaw>();

                if (_interactor == null)
                {
                    _interactor = manager.GetComponentInParent <InteractorRaw>();
                }


                interactor.objectReferenceValue = _interactor;
            }

            if (grabMap.objectReferenceValue == null)
            {
                foreach (var map in manager.inputMappings)
                {
                    Debug.Log(map.mapName.ToLower().Contains("grab"));
                    if (map.mapName.ToLower().Contains("grab"))
                    {
                        grabMap.objectReferenceValue = map;
                    }
                }
            }

            serializedObject.ApplyModifiedProperties();
        }