diff --git a/Assets/Scripts/Buttons/LoadButton.cs b/Assets/Scripts/Buttons/LoadButton.cs index 2786c87..f61547a 100644 --- a/Assets/Scripts/Buttons/LoadButton.cs +++ b/Assets/Scripts/Buttons/LoadButton.cs @@ -13,6 +13,7 @@ public Transform roads; public void OnPointerDown(PointerEventData eventData) { + #if UNITY_EDITOR config.onClick(); string filePath = EditorUtility.OpenFilePanel("Open a road network", "", "json"); if (filePath.Length == 0) { @@ -54,5 +55,6 @@ } road.initialize(roads); } + #endif } } diff --git a/Assets/Scripts/Buttons/LoadButton.cs b/Assets/Scripts/Buttons/LoadButton.cs index 2786c87..f61547a 100644 --- a/Assets/Scripts/Buttons/LoadButton.cs +++ b/Assets/Scripts/Buttons/LoadButton.cs @@ -13,6 +13,7 @@ public Transform roads; public void OnPointerDown(PointerEventData eventData) { + #if UNITY_EDITOR config.onClick(); string filePath = EditorUtility.OpenFilePanel("Open a road network", "", "json"); if (filePath.Length == 0) { @@ -54,5 +55,6 @@ } road.initialize(roads); } + #endif } } diff --git a/Assets/Scripts/Buttons/SaveButton.cs b/Assets/Scripts/Buttons/SaveButton.cs index 0d68921..1fbad21 100644 --- a/Assets/Scripts/Buttons/SaveButton.cs +++ b/Assets/Scripts/Buttons/SaveButton.cs @@ -11,6 +11,7 @@ public Config config; public void OnPointerDown(PointerEventData eventData) { + #if UNITY_EDITOR config.onClick(); List nodes = new List(); foreach (Node node in config.roadNetwork.nodes) { @@ -51,5 +52,6 @@ return; } File.WriteAllBytes(filePath, Encoding.ASCII.GetBytes(jsonData)); + #endif } } diff --git a/Assets/Scripts/Buttons/LoadButton.cs b/Assets/Scripts/Buttons/LoadButton.cs index 2786c87..f61547a 100644 --- a/Assets/Scripts/Buttons/LoadButton.cs +++ b/Assets/Scripts/Buttons/LoadButton.cs @@ -13,6 +13,7 @@ public Transform roads; public void OnPointerDown(PointerEventData eventData) { + #if UNITY_EDITOR config.onClick(); string filePath = EditorUtility.OpenFilePanel("Open a road network", "", "json"); if (filePath.Length == 0) { @@ -54,5 +55,6 @@ } road.initialize(roads); } + #endif } } diff --git a/Assets/Scripts/Buttons/SaveButton.cs b/Assets/Scripts/Buttons/SaveButton.cs index 0d68921..1fbad21 100644 --- a/Assets/Scripts/Buttons/SaveButton.cs +++ b/Assets/Scripts/Buttons/SaveButton.cs @@ -11,6 +11,7 @@ public Config config; public void OnPointerDown(PointerEventData eventData) { + #if UNITY_EDITOR config.onClick(); List nodes = new List(); foreach (Node node in config.roadNetwork.nodes) { @@ -51,5 +52,6 @@ return; } File.WriteAllBytes(filePath, Encoding.ASCII.GetBytes(jsonData)); + #endif } } diff --git a/Assets/Scripts/Buttons/SaveTravelTimes.cs b/Assets/Scripts/Buttons/SaveTravelTimes.cs index ba81649..4bdafb2 100644 --- a/Assets/Scripts/Buttons/SaveTravelTimes.cs +++ b/Assets/Scripts/Buttons/SaveTravelTimes.cs @@ -16,6 +16,7 @@ } public void OnPointerDown(PointerEventData eventData) { + #if UNITY_EDITOR Times time = new Times(); time.travelTimes = config.travelTimes; string jsonData = JsonUtility.ToJson(time); @@ -25,5 +26,6 @@ return; } File.WriteAllBytes(filePath, Encoding.ASCII.GetBytes(jsonData)); + #endif } }