Error while receiving imported file in Unity

Hello everyone, I’m not sure if this is the correct place for posting this, but i wanted to give som feedback on the Import File functionality. Or potentially get some help if the issue is a user error.

I have been experimenting with uploading IFC files using the “Import File” alpha feature. The upload seems to work, and i can wiew the commit, however when i try to receive it in Unity i get an error message:

ArgumentNullException: Value cannot be null.
Parameter name: key

I have since tried to open the IFC file in Revit, and send the model from there. That seemed to solve the issue. However i would prefer uploading the file directly to Speckle, to minimize the number of required applications required to use the tool i am developing.

The aim of posting this is to eigther get a soloutin or explenation of the problem if anyone else has experience. If not i hope the feedback could aid in further developing the “Import File” feature. I’ll add the full error message here:

ArgumentNullException: Value cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) (at <1c8569827291471e9db0dcd976e97952>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].TryGetValue (TKey key, TValue& value) (at <1c8569827291471e9db0dcd976e97952>:0)
Speckle.ConnectorUnity.NativeCache.MemoryNativeCache.TryGetObject (Speckle.Core.Models.Base speckleObject, System.Collections.Generic.List`1[UnityEngine.Object]& nativeObject) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/NativeCache/MemoryNativeCache.cs:31)
Speckle.ConnectorUnity.NativeCache.MemoryNativeCache.TryGetObject[T] (Speckle.Core.Models.Base speckleObject, T& nativeObject) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/NativeCache/MemoryNativeCache.cs:19)
Speckle.ConnectorUnity.NativeCache.AggregateNativeCache.TryGetObject[T] (Speckle.Core.Models.Base speckleObject, T& nativeObject) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/NativeCache/AggregateNativeCache.cs:18)
Objects.Converter.Unity.ConverterUnity.RenderMaterialToNative (Objects.Other.RenderMaterial renderMaterial) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Converter/Unity/ConverterUnity.Mesh.cs:477)
Objects.Converter.Unity.ConverterUnity.<RenderMaterialsToNative>b__74_0 (Objects.Geometry.Mesh m) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Converter/Unity/ConverterUnity.Mesh.cs:456)
System.Linq.Enumerable+SelectListIterator`2[TSource,TResult].ToArray () (at <39d6421ea91449339eee7ef41a176a38>:0)
System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <39d6421ea91449339eee7ef41a176a38>:0)
Objects.Converter.Unity.ConverterUnity.RenderMaterialsToNative (System.Collections.Generic.IEnumerable`1[T] meshes) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Converter/Unity/ConverterUnity.Mesh.cs:456)
Objects.Converter.Unity.ConverterUnity.MeshesToNative (Speckle.Core.Models.Base element, System.Collections.Generic.IReadOnlyCollection`1[T] meshes) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Converter/Unity/ConverterUnity.Mesh.cs:220)
Objects.Converter.Unity.ConverterUnity.DisplayValueToNative (Speckle.Core.Models.Base object) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Converter/Unity/ConverterUnity.cs:144)
Objects.Converter.Unity.ConverterUnity.ConvertToNativeGameObject (Speckle.Core.Models.Base speckleObject) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Converter/Unity/ConverterUnity.cs:119)
Objects.Converter.Unity.ConverterUnity.ConvertToNative (Speckle.Core.Models.Base object) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Converter/Unity/ConverterUnity.cs:49)
Speckle.ConnectorUnity.Components.RecursiveConverter.RecurseTreeToNative (Speckle.Core.Models.Base baseObject, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate, System.Collections.Generic.IList`1[T] outCreatedObjects) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:118)
Speckle.ConnectorUnity.Components.RecursiveConverter.ConvertChild (System.Object value, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate, System.Collections.Generic.IList`1[T] outCreatedObjects) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:165)
Speckle.ConnectorUnity.Components.RecursiveConverter.RecurseTreeToNative (Speckle.Core.Models.Base baseObject, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate, System.Collections.Generic.IList`1[T] outCreatedObjects) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:148)
Speckle.ConnectorUnity.Components.RecursiveConverter.ConvertChild (System.Object value, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate, System.Collections.Generic.IList`1[T] outCreatedObjects) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:165)
Speckle.ConnectorUnity.Components.RecursiveConverter.RecurseTreeToNative (Speckle.Core.Models.Base baseObject, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate, System.Collections.Generic.IList`1[T] outCreatedObjects) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:148)
Speckle.ConnectorUnity.Components.RecursiveConverter.ConvertChild (System.Object value, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate, System.Collections.Generic.IList`1[T] outCreatedObjects) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:165)
Speckle.ConnectorUnity.Components.RecursiveConverter.RecurseTreeToNative (Speckle.Core.Models.Base baseObject, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate, System.Collections.Generic.IList`1[T] outCreatedObjects) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:148)
Speckle.ConnectorUnity.Components.RecursiveConverter.ConvertChild (System.Object value, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate, System.Collections.Generic.IList`1[T] outCreatedObjects) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:165)
Speckle.ConnectorUnity.Components.RecursiveConverter.RecurseTreeToNative (Speckle.Core.Models.Base baseObject, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate, System.Collections.Generic.IList`1[T] outCreatedObjects) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:148)
Speckle.ConnectorUnity.Components.RecursiveConverter.ConvertChild (System.Object value, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate, System.Collections.Generic.IList`1[T] outCreatedObjects) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:165)
Speckle.ConnectorUnity.Components.RecursiveConverter.RecursivelyConvertToNative (System.Object o, UnityEngine.Transform parent, System.Func`2[T,TResult] predicate) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/RecursiveConverter.ToNative.cs:90)
Speckle.ConnectorUnity.Components.SpeckleReceiver.ConvertToNativeWithCategories (Speckle.Core.Models.Base base, System.String rootObjectName, System.Action`1[T] beforeConvertCallback) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Runtime/Components/SpeckleReceiver.cs:199)
Speckle.ConnectorUnity.Components.Editor.SpeckleReceiverEditor.Convert (Speckle.ConnectorUnity.Components.SpeckleReceiver receiver, Speckle.Core.Models.Base commitObject, System.String name) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Editor/Components/SpeckleReceiverEditor.cs:120)
Speckle.ConnectorUnity.Components.Editor.SpeckleReceiverEditor.ReceiveAndConvert (Speckle.ConnectorUnity.Components.SpeckleReceiver speckleReceiver) (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Editor/Components/SpeckleReceiverEditor.cs:99)
Speckle.ConnectorUnity.Components.Editor.SpeckleReceiverEditor.OnInspectorGUI () (at Library/PackageCache/systems.speckle.speckle-unity@59221e89ba/Editor/Components/SpeckleReceiverEditor.cs:76)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <1c8569827291471e9db0dcd976e97952>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <f712b1dc50b4468388b9c5f95d0d0eaf>:0)
UnityEngine.UnitySynchronizationContext.Exec () (at <f712b1dc50b4468388b9c5f95d0d0eaf>:0)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <f712b1dc50b4468388b9c5f95d0d0eaf>:0)

This is a helpful report @OdinIversen. Welcome to the Community; this is the right place.

We, too, would like this to be as simple as importing IFC and receiving in Unity. Not everyone has a handy copy of Revit lying around.

Can you share a stream with us, either here or by DM, and the Unity Connector team can confirm the issue? Interestingly, the same stream received in Revit and resent fixes the issue. If you can share a problematic IFC, even better.

We can chase those pesky nulls by capturing them better in Unity (as we seem to in Revit) or by investigating the IFC mesh creation.


We would love to know more about your plans for IFC->Unity, as it isn’t something we haven’t often heard. In general terms, no need to reveal your world-changing IFC AR for Apple Googles just yet :smiley:

1 Like

Thank you for the quick reply! I have asked my supervisor if I am allowed to share the IFC-model, and will get back to you soon.

I’m working as a reserch assistant for a project regarding Digital Twins, and among other things we are looking into ways for extending the use of BIM-models into the operational phase for structures. In general terms I am developing a visualization tool, to display live data in the BIM-model. I have made a working prototype, and I’m currently trying to streamline the process and make it more user friendly, so it can be easily implimented for other projects and structures.

1 Like

I got permission to share the IFC-files and stream ID with the Speckle team, and have attempted to do so in a DM. Thank you for looking into this issue.