Skip to content

Commit 48dc414

Browse files
authored
Merge pull request #470 from umasteeringgroup/MeshModifiers
Attempted Fix of random clearing of global library on domain reload
2 parents 8ebb52a + 766df43 commit 48dc414

File tree

3 files changed

+39
-4
lines changed

3 files changed

+39
-4
lines changed

UMAProject/Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,11 +509,23 @@ public void Awake()
509509
#if UNITY_EDITOR
510510
[UnityEditor.Callbacks.DidReloadScripts]
511511
private static void OnScriptsReloaded()
512+
{
513+
if (EditorApplication.isCompiling || EditorApplication.isUpdating)
514+
{
515+
// Try again after compiling and updating finished.
516+
EditorApplication.delayCall += OnScriptsReloaded;
517+
return;
518+
}
519+
520+
EditorApplication.delayCall += RebuildAllEditTimeAvatars;
521+
}
522+
523+
private static void RebuildAllEditTimeAvatars()
512524
{
513525
if (!EditorApplication.isPlayingOrWillChangePlaymode)
514526
{
515527
DynamicCharacterAvatar[] dcas = GameObject.FindObjectsOfType<DynamicCharacterAvatar>();
516-
for(int i=0; i<dcas.Length ; i++)
528+
for (int i = 0; i < dcas.Length; i++)
517529
{
518530
DynamicCharacterAvatar dca = dcas[i];
519531
if (dca.editorTimeGeneration)

UMAProject/Assets/UMA/Core/Scripts/UMAAssetIndexer.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,13 @@ public static UMAAssetIndexer Instance
181181
{
182182
if (theIndexer == null)
183183
{
184+
#if UNITY_EDITOR
185+
if (EditorApplication.isCompiling)
186+
{
187+
Debug.Log("Warning: Attempted to get instance while compiling.");
188+
return null;
189+
}
190+
#endif
184191
//var st = StartTimer();
185192
theIndexer = Resources.Load("AssetIndexer") as UMAAssetIndexer;
186193
if (theIndexer == null)
@@ -1873,7 +1880,7 @@ public void UnloadAll(bool forceResourceUnload)
18731880
}
18741881
}
18751882
#endif
1876-
#endregion
1883+
#endregion
18771884

18781885
#region Add Remove Assets
18791886

@@ -2331,7 +2338,7 @@ public void DeleteAsset(System.Type type, string Name)
23312338
}
23322339

23332340
#endif
2334-
#endregion
2341+
#endregion
23352342

23362343
#region Maintenance
23372344

@@ -2355,6 +2362,15 @@ public void ClearAddressableFlags()
23552362
public void UpdateSerializedDictionaryItems()
23562363
{
23572364
DebugSerialization("Updating serialized Dictionary Items");
2365+
if (SerializedItems == null)
2366+
{
2367+
DebugSerialization("Serialized Items is null");
2368+
return;
2369+
}
2370+
if (SerializedItems.Count == 0)
2371+
{
2372+
DebugSerialization("Serialized Items is empty!!!");
2373+
}
23582374
// Rebuuild all the lookup tables
23592375
// Lookup by guid
23602376
GuidTypes = new Dictionary<string, AssetItem>();
@@ -2951,6 +2967,7 @@ public void RebuildIndex()
29512967
#region Serialization
29522968
void ISerializationCallbackReceiver.OnBeforeSerialize()
29532969
{
2970+
DebugSerialization("Before Serialize called");
29542971
UpdateSerializedList();
29552972

29562973
// load typeFolders so it can be serialized.
@@ -2962,6 +2979,7 @@ void ISerializationCallbackReceiver.OnBeforeSerialize()
29622979
tpf.Folders = kpv.Value.ToArray();
29632980
typeFolders.Add(tpf);
29642981
}
2982+
DebugSerialization("Before Serialize complete");
29652983
}
29662984

29672985
void ISerializationCallbackReceiver.OnAfterDeserialize()
@@ -3065,7 +3083,13 @@ void ISerializationCallbackReceiver.OnAfterDeserialize()
30653083
TypeLookup = new Dictionary<Type, Dictionary<string, AssetItem>>();
30663084
}
30673085
}
3086+
3087+
// should it call UpdateSerializeDictionaryItems()???
3088+
// NO IT SHOULD NOT
3089+
// THIS IS DONE WHERE THE SINGLETON IS CREATED ABOVE
3090+
30683091
StopTimer(st, "After Serialize");
3092+
DebugSerialization("After Deserialize complete");
30693093
}
30703094

30713095
#if UNITY_EDITOR

UMAProject/Assets/UMA/Core/Scripts/UMASettings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using UnityEngine;
55
using UnityEditor;
66
using UMA;
7-
using Codice.CM.WorkspaceServer.DataStore.Merge;
87
using System.Threading;
98
using System.Diagnostics;
109

0 commit comments

Comments
 (0)