Unity SpecklePlayground standalone(win) build not working


I’m just curious why the SpecklePlayground sample (ref GitHub - specklesystems/speckle-unity: AEC Interoperability for Unity through Speckle) is not working when it’s built as a Standalone Windows app. In the Editor, everything works cool, but when built I’m getting this view:

Did I miss something, or the Speckle Examples script can’t recognize the running Speckle Manager on standalone build?

1 Like

Hey @dr.P , I haven’t actually tried building the project, not sure what could be happening :grimacing:

Are you running it on a machine that has Manager installer and at least one account set up?
Is there a way to see any of the (probably many) console errors?

I’ll give it a go in the next days to see what’s going on, unless you beat me to it :slight_smile:

Hey @teocomi , thanks for the reply!

It turned out as an Architecture error, I built the project on x86 and some scripts wasn’t cool with that, so I switched to x86_64 and now it works, kinda, because now I have a new error when I try to stream a project from the Speckle.xyz server, here is the full log (btw it loads some objects and after like 3-4 objects loaded it throws this error, so this error happens while streaming the data):

> The referenced script on this Behaviour (Game Object 'Main Camera') is missing!
UnloadTime: 0.804600 ms
  Debug: Logging enabled with ConsoleDiagnosticLogger and min level: Debug
Warning: Init was called but no DSN was provided nor located. Sentry SDK will be disabled.
Websocket is open
ArgumentNullException: Value cannot be null.
Parameter name: shader
  at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
  at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00008] in C:\buildslave\unity\build\Runtime\Export\Shaders\Shader.bindings.cs:122 
  at Objects.Converter.Unity.ConverterUnity.GetMaterial (Objects.Other.RenderMaterial renderMaterial) [0x0008e] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\ConverterUnity.Geometry.cs:359 
  at Objects.Converter.Unity.ConverterUnity.MeshToNative (Objects.Geometry.Mesh speckleMesh, Objects.Other.RenderMaterial renderMaterial, System.Collections.Generic.Dictionary`2[TKey,TValue] properties) [0x00194] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\ConverterUnity.Geometry.cs:279 
  at Objects.Converter.Unity.ConverterUnity.MeshToNative (Speckle.Core.Models.Base speckleMeshObject) [0x0001f] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\ConverterUnity.Geometry.cs:220 
  at Objects.Converter.Unity.ConverterUnity.ConvertToNative (Speckle.Core.Models.Base object) [0x0002c] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\ConverterUnity.cs:68 
  at Speckle.ConnectorUnity.Receiver.TryConvertItemToNative (System.Object value) [0x00124] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\Receiver.cs:292 
Rethrow as SpeckleException: Value cannot be null.
Parameter name: shader
  at Speckle.ConnectorUnity.Receiver.TryConvertItemToNative (System.Object value) [0x001ac] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\Receiver.cs:309 
  at Speckle.ConnectorUnity.Receiver.RecurseTreeToNative (System.Object object) [0x000aa] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\Receiver.cs:240 
  at Speckle.ConnectorUnity.Receiver.<RecurseTreeToNative>b__22_0 (System.Object x) [0x00000] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\Receiver.cs:229 
  at System.Linq.Enumerable+WhereSelectListIterator`2[TSource,TResult].MoveNext () [0x0004d] in <55b3683038794c198a24e8a1362bfc61>:0 
  at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].MoveNext () [0x0004e] in <55b3683038794c198a24e8a1362bfc61>:0 
  at System.Collections.Generic.List`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00077] in <2b3a3162be434770b7a4fac8b896e90c>:0 
  at System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0000e] in <55b3683038794c198a24e8a1362bfc61>:0 
  at Speckle.ConnectorUnity.Receiver.RecurseTreeToNative (System.Object object) [0x0001b] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\Receiver.cs:229 
  at Speckle.ConnectorUnity.Receiver.ConvertRecursivelyToNative (Speckle.Core.Models.Base base, System.String name) [0x0008d] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\Receiver.cs:206 
  at Speckle.ConnectorUnity.Receiver+<>c__DisplayClass20_1.<GetAndConvertObject>b__0 () [0x00001] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\Receiver.cs:160 
  at Speckle.ConnectorUnity.Dispatcher+<ActionWrapper>d__5.MoveNext () [0x00020] in C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\Dispatcher.cs:89 
  at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00020] in C:\buildslave\unity\build\Runtime\Export\Scripting\Coroutines.cs:17 
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) (at C:\buildslave\unity\build\Runtime\Export\Scripting\MonoBehaviour.bindings.cs:91)
Speckle.ConnectorUnity.<>c__DisplayClass2_0:<Enqueue>b__0() (at C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\Dispatcher.cs:48)
Speckle.ConnectorUnity.Dispatcher:Update() (at C:\repos\Speckle\SpeckleUnityStandalone\Assets\Speckle Connector\Dispatcher.cs:36)

(Filename: C:/buildslave/unity/build/Runtime/Export/Shaders/Shader.bindings.cs Line: 122)

This log indicates an issue with a missing shader. The interesting part is that I can’t reproduce this error when I play the project in Editor… :thinking:

BTW, just to reply to your question about the Manager: Yes, I’m running it on a machine that has the Manager installed and Running as well as an account all set up.

Sweet, good find! I’ll add it to the docs :slight_smile:

Re missing shader, it seems this could resolve it: Shader Missing in Builds When Called From Shader.Find("") - Unity Answers

1 Like

Great link for the missing shader @teocomi ! It solved the issue.

These 2 shaders should be added into:

Project Settings → Graphics → Built-in Shader Settings → Always Included shaders

I also found another issue which I didn’t mention, The RoslynDirectoryCreator.cs script is by default in the Extra folder, but if you want to build the project the outcome won’t be so Extra :stuck_out_tongue: since it throws a missing reference error which looks something like this:

Assets\Extra\RosolynDirectoryCreator.cs(13,4): error CS0246: The type or namespace name ‘InitializeOnLoad’ could not be found

Since I’m not sure if we need this in the build at all I just created a new folder in the Assets and named it Editor, I placed the script there, and the build should be successful since the Editor folder won’t be included in the build by default. Let me know if it’s a wrong or a reasonable solution. :slight_smile:

1 Like

Great stuff! I’ll make sure to add these to our docs, thanks for trying it out :slight_smile:
Any other feedback, just send it our way!

1 Like