Revit to Unity not working

Hello,

For some reason, in Revit, I can’t create a proper stream sender with the Speckle plugin. I login to Hestia server then I try to create a sender (I tried all options for adding objects: by selection, category and view) and it creates the sender but for some reason the stream is not working in Unity. First I want to note that I’m getting an error sometimes (so I don’t get it every time) in Revit with the following message:
"A serious error occured. The current action has been canceled. It is strongly reccommended that you save your work in a new file before continuing… "

The strange part is that, despite this error message, the stream is created on the Hestia server… But when I try to stream any of these streams (created with or without the error message) from Hestia to Unity, I’m logged in successfully and when it tried to stream the data the following error is shown:

NullReferenceException: Object reference not set to an instance of an object
SpeckleUnity.SpeckleUnityReceiver.SetScaleFactorAccordingToStream () (at Assets/SpeckleUnity/Assets/SpeckleUnity/Runtime/Scripts/Clients/SpeckleUnityReceiver.cs:493)
SpeckleUnity.SpeckleUnityReceiver+<UpdateGlobal>d__17.MoveNext () (at Assets/SpeckleUnity/Assets/SpeckleUnity/Runtime/Scripts/Clients/SpeckleUnityReceiver.cs:235)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.GetResult () (at <9577ac7a62ef43179789031239ba8798>:0)
SpeckleUnity.SpeckleUnityReceiver+<InitializeClient>d__14.MoveNext () (at Assets/SpeckleUnity/Assets/SpeckleUnity/Runtime/Scripts/Clients/SpeckleUnityReceiver.cs:146)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.GetResult () (at <9577ac7a62ef43179789031239ba8798>:0)
SpeckleUnity.SpeckleUnityManager+<AddReceiverAsync>d__31.MoveNext () (at Assets/SpeckleUnity/Assets/SpeckleUnity/Runtime/Scripts/SpeckleUnityManager.cs:371)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.GetResult () (at <9577ac7a62ef43179789031239ba8798>:0)
SpeckleUnity.SpeckleUnityManager+<LoginAsync>d__25.MoveNext () (at Assets/SpeckleUnity/Assets/SpeckleUnity/Runtime/Scripts/SpeckleUnityManager.cs:228)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.TaskAwaiter.GetResult () (at <9577ac7a62ef43179789031239ba8798>:0)
SpeckleUnity.SpeckleUnityManager+<LoadSpeckleProject>d__22.MoveNext () (at Assets/SpeckleUnity/Assets/SpeckleUnity/Runtime/Scripts/SpeckleUnityManager.cs:145)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <9577ac7a62ef43179789031239ba8798>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <9577ac7a62ef43179789031239ba8798>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <04258d1cdc1044248c2a17a6a31a3cf7>:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

I would like to note that I’m able to stream an older data from Speckle (created 2 months ago) to Unity, I’m just unable to get it work with the latest streams. Any thoughts?

Hey @dr.P, welcome to the forum!

There’s a few things that could be going on, here’s what I’d check.

  • Are you trying to send any specific type of Revit elements? Not all families are currently supported, so maybe try with something that should work, eg walls.
  • Have you checked the raw stream data to see if actually the objects make it out of Revit and into Speckle? You can do so by pasting this API endpoing in your browser: https://hestia.speckle.works/api/streams/<STREAMID/objects
  • The error you pasted is thrown inside the Unity connector when it’s attempting to scale the incoming geometry, you could commenting SetScaleFactorAccordingToStream(); on line 232 in SpeckleUnityReceiver.cs and see what happens. Worst case, the geometry won’t be scaled!
  • You probably already did, but make sure you have the latest version of the Revit and Unity connector (which are installed separately)

One good news is that we started working on a 2.x Unity connector for Speckle that will hopefully be more stable and performant!

Happy last day of the year,
Matteo

Hey @teocomi, thank you!

  1. I tried to send only walls for example, but no luck so far.
  2. I did check the stream data as you suggested the response is:
    {“success”:true,“resources”:[],“message”:“Object list returned. If querying, duplication of objects in list will not be respected.”}
  3. The unity error is gone after I commented the method you suggested, thank you!
  4. I’m using the latest connector.

Now since I don’t have the error inside unity, I’m getting the success message in the console, but I still can’t get the objects to the scene. Right now, the hierarchy after the stream looks like this:
hierarchy

Any idea what should I do further?

I’m afraid I’m out of breath here! But I recently started developing a 2.0 connector (Speckle Unity 2.0, feedback wanted! 🤺)
It’s highly WIP, but maybe it can help!