private static void UpdateAllControllerMappingProfiles() { string[] guids = AssetDatabase.FindAssets("t:MixedRealityControllerMappingProfile"); string[] assetPaths = new string[guids.Length]; for (int i = 0; i < guids.Length; i++) { string guid = guids[i]; assetPaths[i] = AssetDatabase.GUIDToAssetPath(guid); MixedRealityControllerMappingProfile asset = AssetDatabase.LoadAssetAtPath(assetPaths[i], typeof(MixedRealityControllerMappingProfile)) as MixedRealityControllerMappingProfile; List <MixedRealityControllerMapping> updatedMappings = new List <MixedRealityControllerMapping>(); foreach (MixedRealityControllerMapping mapping in asset.MixedRealityControllerMappings) { if (mapping.ControllerType.Type == null) { continue; } if (!mapping.HasCustomInteractionMappings) { mapping.UpdateInteractionSettingsFromDefault(); } updatedMappings.Add(mapping); } asset.mixedRealityControllerMappings = updatedMappings.ToArray(); } AssetDatabase.ForceReserializeAssets(assetPaths); }
private static void UpdateAllControllerMappingProfiles() { foreach (string guid in AssetDatabase.FindAssets("t:MixedRealityControllerMappingProfile")) { MixedRealityControllerMappingProfile asset = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid), typeof(MixedRealityControllerMappingProfile)) as MixedRealityControllerMappingProfile; List <MixedRealityControllerMapping> updatedMappings = new List <MixedRealityControllerMapping>(); foreach (MixedRealityControllerMapping mapping in asset.MixedRealityControllerMappings) { if (mapping.ControllerType.Type == null) { continue; } if (!mapping.HasCustomInteractionMappings) { mapping.UpdateInteractionSettingsFromDefault(); } updatedMappings.Add(mapping); } asset.mixedRealityControllerMappings = updatedMappings.ToArray(); EditorUtility.SetDirty(asset); } }