Hello again. I briefly mentioned a lower priority issue in this thread (SourceBankPathUnformatted destroyed by SourceBankPathRelative).
Long story short, one of our engineers wasn’t particularly happy with the frequency of calls to EditorUtility.SetDirty
inside EventManager
's OnCacheChange
function, given that the data hasn’t actually changed.
They asked me to recommend a change we made, where we would check the banks, and to only SetDirty
and Repaint
when an actual change had occurred.
static List<string> tempMasterBanks = new List<string>();
static List<string> tempBanks = new List<string>();
static void OnCacheChange()
{
var settings = Settings.Instance;
bool hasChanged = false;
tempMasterBanks.Clear();
foreach (EditorBankRef bankRef in eventCache.MasterBanks)
{
tempMasterBanks.Add(bankRef.Name);
}
if (!CompareLists(tempMasterBanks, settings.MasterBanks))
{
settings.MasterBanks.Clear();
settings.MasterBanks.AddRange(tempMasterBanks);
hasChanged = true;
}
tempBanks.Clear();
foreach (var bankRef in eventCache.EditorBanks)
{
if (!eventCache.MasterBanks.Contains(bankRef) &&
!eventCache.StringsBanks.Contains(bankRef))
{
tempBanks.Add(bankRef.Name);
}
}
tempBanks.Sort((a, b) => string.Compare(a, b, StringComparison.CurrentCultureIgnoreCase));
if (!CompareLists(tempBanks, settings.Banks))
{
settings.Banks.Clear();
settings.Banks.AddRange(tempBanks);
hasChanged = true;
}
if (hasChanged)
{
EditorUtility.SetDirty(settings);
EventBrowser.RepaintEventBrowser();
}
}
Unity 2019.1.14f1
and FMOD Unity Integration 2.00.04
.