diff --git a/UnityProject/Assets/Plugins/Zenject/Source/Runtime/Injection/InjectContext.cs b/UnityProject/Assets/Plugins/Zenject/Source/Runtime/Injection/InjectContext.cs index 86d13be60..2825a201b 100644 --- a/UnityProject/Assets/Plugins/Zenject/Source/Runtime/Injection/InjectContext.cs +++ b/UnityProject/Assets/Plugins/Zenject/Source/Runtime/Injection/InjectContext.cs @@ -268,6 +268,28 @@ public string GetObjectGraphString() result.AppendLine(context.ObjectType.PrettyName()); } +#if !NOT_UNITY3D + if (this.ObjectInstance is UnityEngine.Component component) + { + // Print the GameObject hierarchy + var transform = component.transform; + while (transform != null) + { + if (transform.name.EndsWith("(Clone)")) + { + // Stop printing when we find an instantiated object, we are validating that prefab + result.AppendLine(transform.name.Replace("(Clone)", " (prefab)")); + break; + } + else + { + result.AppendLine(transform.name); + transform = transform.parent; + } + } + } +#endif + return result.ToString(); } } diff --git a/UnityProject/Assets/Plugins/Zenject/Source/Runtime/Providers/SubContainerCreators/SubContainerCreatorCached.cs b/UnityProject/Assets/Plugins/Zenject/Source/Runtime/Providers/SubContainerCreators/SubContainerCreatorCached.cs index b099aae78..c354c35b5 100644 --- a/UnityProject/Assets/Plugins/Zenject/Source/Runtime/Providers/SubContainerCreators/SubContainerCreatorCached.cs +++ b/UnityProject/Assets/Plugins/Zenject/Source/Runtime/Providers/SubContainerCreators/SubContainerCreatorCached.cs @@ -34,8 +34,10 @@ public DiContainer CreateSubContainer(List args, InjectContext co if (_subContainer == null) { #if !ZEN_MULTITHREADING - Assert.That(!_isLookingUp, - "Found unresolvable circular dependency when looking up sub container! Object graph:\n {0}", context.GetObjectGraphString()); + if (this._isLookingUp) + { + Assert.That(false, "Found unresolvable circular dependency when looking up sub container! Object graph:\n {0}", context.GetObjectGraphString()); + } _isLookingUp = true; #endif @@ -48,7 +50,7 @@ public DiContainer CreateSubContainer(List args, InjectContext co Assert.IsNotNull(_subContainer); } - else + else { injectAction = null; }