AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
CompoundButtonSaveInterceptor.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using UnityEditor;
5 using UnityEngine;
7 
8 public class CompoundButtonSaveInterceptor : UnityEditor.AssetModificationProcessor
9 {
10  public static string[] OnWillSaveAssets(string[] paths)
11  {
12  // Tell our mesh buttons and icons to switch over to non-instanced materials
13  // This will prevent them from saving the scene with broken material links
14  // Materials will be re-instanced immediately afterward so this should have no effect
15 
16  CompoundButtonMesh[] meshButtons = GameObject.FindObjectsOfType<CompoundButtonMesh>();
17  foreach (CompoundButtonMesh meshButton in meshButtons)
18  {
19  meshButton.OnWillSaveScene();
20  }
21 
22  CompoundButtonIcon[] iconButtons = GameObject.FindObjectsOfType<CompoundButtonIcon>();
23  foreach (CompoundButtonIcon iconButton in iconButtons)
24  {
25  iconButton.OnWillSaveScene();
26  }
27 
28  return paths;
29  }
30 }
Mesh button is a mesh renderer interactable with state data for button state
static string [] OnWillSaveAssets(string[] paths)