Skip to content

Commit

Permalink
fix: always clean the prefab name before splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
MSchmoecker committed Jan 2, 2024
1 parent 666c8a8 commit 6475324
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions JotunnLib/Managers/MockSystem/MockManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ public static T GetRealPrefabFromMock<T>(Object unityObject) where T : Object
/// <returns>the real prefab</returns>
public static Object GetRealPrefabFromMock(Object unityObject, Type mockObjectType)
{
if (!unityObject || !IsMockName(unityObject.name, out string assetName, out List<string> childNames))
if (!unityObject)
{
return null;
}

if (!IsMockName(GetCleanedName(mockObjectType, unityObject.name), out string assetName, out List<string> childNames))
{
return null;
}
Expand Down Expand Up @@ -189,7 +194,6 @@ public static Object GetRealPrefabFromMock(Object unityObject, Type mockObjectTy

private static bool TryGetAsset(Type mockObjectType, string assetName, out Object asset)
{
assetName = GetCleanedName(mockObjectType, assetName);
asset = PrefabManager.Cache.GetPrefab(mockObjectType, assetName);
return (bool)asset;
}
Expand Down

0 comments on commit 6475324

Please sign in to comment.