private void OnApplicationQuit() { foreach (HapticDevice hapticDevice in manager.GetSetOfActiveDevices()) { hapticDevice.HapticFeedbackPlayed -= HapticDevice_HapticFeedbackPlayed; } }
void Start() { manager = FindObjectOfType <HapticManager>(); // Hook into every device's event in the scene to know when they play a haptic pulse foreach (HapticDevice hapticDevice in manager.GetSetOfActiveDevices()) { hapticDevice.HapticFeedbackPlayed += HapticDevice_HapticFeedbackPlayed; } // Grab all the body coordinates below this script in the hierarchy and save a reference to it bodyPartToCoordinate = new Dictionary <HumanBodyBones, BodyCoordinate>(); foreach (BodyCoordinate bodyCoordinate in GetComponentsInChildren <BodyCoordinate>()) { if (!bodyPartToCoordinate.ContainsKey(bodyCoordinate.attachedBody)) { bodyPartToCoordinate.Add(bodyCoordinate.attachedBody, bodyCoordinate); } } }