From 5a6b4f4d2cd18203356a5889350e9cab029091f3 Mon Sep 17 00:00:00 2001 From: Steve Halliwell Date: Sun, 8 Dec 2019 10:58:30 +1000 Subject: [PATCH] Block and Variable reference string formating moved to arrays rather than lists for back compat --- Assets/Fungus/Scripts/Editor/BlockEditor.cs | 4 ++-- .../Fungus/Scripts/Editor/VariableListAdaptor.cs | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Assets/Fungus/Scripts/Editor/BlockEditor.cs b/Assets/Fungus/Scripts/Editor/BlockEditor.cs index 412fe488..04e178b0 100644 --- a/Assets/Fungus/Scripts/Editor/BlockEditor.cs +++ b/Assets/Fungus/Scripts/Editor/BlockEditor.cs @@ -72,9 +72,9 @@ namespace Fungus.EditorUtils .Where(x => x is IBlockCaller) .Select(x => x as IBlockCaller) .Where(x => x.MayCallBlock(targetBlock)) - .Select(x => x.GetLocationIdentifier()).ToList(); + .Select(x => x.GetLocationIdentifier()).ToArray(); - if (callers.Count > 0) + if (callers != null && callers.Length > 0) callersString = string.Join("\n", callers); else callersString = "None"; diff --git a/Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs b/Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs index fcc6cd15..fc594466 100644 --- a/Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs +++ b/Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs @@ -317,14 +317,20 @@ namespace Fungus.EditorUtils { var varRefs = EditorExtensions.FindObjectsOfInterface() .Where(x => x.HasReference(variable)) - .Select(x => x.GetLocationIdentifier()).ToList(); ; + .Select(x => x.GetLocationIdentifier()).ToArray(); ; - string varRefString = variable.Key + " referenced in;\n"; + string varRefString = variable.Key; - if (varRefs.Count > 0) - varRefString += string.Join("\n", varRefs); + if (varRefs != null && varRefs.Length > 0) + { + varRefString += " referenced in " + varRefs.Length.ToString() + " places:\n"; + + varRefString += string.Join("\n - ", varRefs); + } else - varRefString += "None"; + { + varRefString += ", found no references."; + } Debug.Log(varRefString); }