specklesystems / speckle-unity

AEC Interoperability for Unity through Speckle
https://speckle.systems/tag/unity/
Apache License 2.0
55 stars 20 forks source link

[macOS] seemingly missing dll reference prevents use #57

Closed philipbelesky closed 2 years ago

philipbelesky commented 2 years ago

Hi! I was following along the documentation and encounter an error when attempting to add the Stream Manager to an empty Game Object. This occurs with Unity 2020.3.21f1 or 2021.2.8f1 running on macOS. After the error appears, the Stream Manager attaches to the object but does not have any fields.

DllNotFoundException: SQLite.Interop.dll assembly:<unknown assembly> type:<unknown type> member:(null)
System.Data.SQLite.SQLite3.Open (System.String strFilename, System.String vfsName, System.Data.SQLite.SQLiteConnectionFlags connectionFlags, System.Data.SQLite.SQLiteOpenFlagsEnum openFlags, System.Int32 maxPoolSize, System.Boolean usePool) (at <c8c2e4911ed34956a0a24a3548a3c49c>:0)
System.Data.SQLite.SQLiteConnection.Open () (at <c8c2e4911ed34956a0a24a3548a3c49c>:0)
Speckle.Core.Transports.SQLiteTransport+<GetAllObjects>d__66.MoveNext () (at <943162bfe3e94db593fcade4af5d1518>:0)
System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].MoveNext () (at <37609d1fc2d04496895227262e1b2fe0>:0)
System.Collections.Generic.List`1[T].AddEnumerable (System.Collections.Generic.IEnumerable`1[T] enumerable) (at <e7b4371ec0dc4ed2ab84299cc150e9c3>:0)
System.Collections.Generic.List`1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable`1[T] collection) (at <e7b4371ec0dc4ed2ab84299cc150e9c3>:0)
System.Collections.Generic.List`1[T].AddRange (System.Collections.Generic.IEnumerable`1[T] collection) (at <e7b4371ec0dc4ed2ab84299cc150e9c3>:0)
System.Linq.Enumerable+ConcatIterator`1[TSource].ToList () (at <37609d1fc2d04496895227262e1b2fe0>:0)
System.Linq.Enumerable.ToList[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at <37609d1fc2d04496895227262e1b2fe0>:0)
Speckle.ConnectorUnity.StreamManagerEditor.LoadAccounts () (at Packages/systems.speckle.speckle-unity/Editor/StreamManagerEditor.cs:103)
Speckle.ConnectorUnity.StreamManagerEditor.OnInspectorGUI () (at Packages/systems.speckle.speckle-unity/Editor/StreamManagerEditor.cs:213)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <e7b4371ec0dc4ed2ab84299cc150e9c3>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:153)
UnityEngine.UnitySynchronizationContext.Exec () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:83)
UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:107)

Hopefully this isn't anything specific to my machine. I also wasn't sure if macOS was supported.

If helpful, I could attempt a PR for this although would need some pointers - my experience with .NET dependency management is pretty limited.

teocomi commented 2 years ago

Hey @philipbelesky , thanks for the bug report! We have never tested the unity connector on macOS, so I'm not surprised we have some surprises :) If you wanted to look into this it'd be great, as we're not heavy mac users our resources are limited here.

A quick test you could do is to manually build Core and then copy its DLLs inside the Core folder in the connector.

Otherwise @JR-Morgan might have better ideas!

philipbelesky commented 2 years ago

Thanks for the advice, below are the steps I used to resolve this:

'/Applications/Unity/Hub/Editor/2021.2.8f1/Unity.app/Contents/NetStandard/Extensions/2.0.0/System.Runtime.InteropServices.WindowsRuntime.dll' and '/Users/philip/Sites/speckle-unity/Packages/systems.speckle.speckle-unity/Core/System.Runtime.InteropServices.WindowsRuntime.dll'. Remove one of the duplicate references.

- Deleted the duplicate dll as per error
- Then: same error for `Microsoft.CSharp.dll`; deleted it
- Then:
    /Users/philip/Sites/speckle-unity/Packages/systems.speckle.speckle-unity/ConverterUnity.cs(15,41): error CS0535: 'ConverterUnity' does not implement interface member lISpeckleConverter.SetConverterSettings(object)'

- I checked out `all/2.2.4` for the `Core` repo, built it, then repeated the above deletions
- The `Stream Manager` showed the correct parameters and could receive/create data from a Stream

The exact diff for the dependencies [can be seen over here](https://github.com/philipbelesky/speckle-unity/commit/98ed7d914138187440a4bde088221827afa28275). I could make a PR for those but I suspect it isn't of much value and might have Windows regressions.

Having to downgrade the version of `Core` due to that `ConverterUnity.cs` error suggests that a different issue might crop up whenever `Core` is bumped in this repo. Perhaps whenever the `Core` dependencies in this repo are bumped to latest, I could do some more extensive testing across both platforms?
JR-Morgan commented 2 years ago

@philipbelesky

Thanks for the investigation, and for the clear steps you took to fix the issue.

The current version of the Unity connector actually uses a 2.2.4 core, so I wonder went wrong when I updated it last 😕. Do please submit a PR in the meantime, as it sounds like you've managed to fix the issue with mac.

I have a few items on the todo list that will require a core bump to 2.3.0, so I'll give updating to 2.3.0 a go when I address those. I'll have a conversation with @teocomi about including mac in our test procedure to make sure unexpected issues like this are less frequent.

JR-Morgan commented 2 years ago

This should have been closed a while ago. No issues reported from MacOS users. And was tested several releases ago (2.6), and on the current release (2.9)