private void OnDestroy()
 {
     // If we call StringAssetUtil.WriteJsonObject... in editor, it calls AssetDatabase.ImportAsset
     // Importing a Resource like a json can cause other Shader resources with float4x4 properties to discard their previously set properties.
     // So only write json when object is being destroyed
     if (sparseUpdates != null)
     {
         string stateUpdateFilename = string.Format("DisplayConfigUpdate{0}.json", isSlantedState ? "Slanted" : "Square");
         StringAssetUtil.WriteJsonObjectToDeviceAwareFilename(stateUpdateFilename, sparseUpdates, true);
     }
 }
        public void ResetValues()
        {
            sparseUpdates.Clear();

            // trigger a write of a blank SparseUpdates file
            string stateUpdateFilename = string.Format("DisplayConfigUpdate{0}.json", isSlantedState ? "Slanted" : "Square");

            StringAssetUtil.WriteJsonObjectToDeviceAwareFilename(stateUpdateFilename, sparseUpdates, true);

            this.DeconstructUI();

            // reload DisplayConfig from firmware up
            LeiaDisplay.Instance.LeiaDevice.GetDisplayConfig(true);
            LeiaDisplay.Instance.UpdateDevice();

            // reload UI, rebind callbacks
            this.ConstructUI();
        }