microsoft / MixedReality-SpectatorView

Mixed reality spectator experiences
MIT License
193 stars 113 forks source link

InvalidCastException #366

Open lust0yixiong opened 4 years ago

lust0yixiong commented 4 years ago

The Kinect observer is normal when i run a simple Demo(such as a cube or a ball in scene), but when i apply the project with my own application, it can't work.(we can locate the right position with QR code, but the context can't sync). The Hololens2 act as user, and the Azure act as observer. And the Debug error info is below: _### InvalidCastException: Specified cast is not valid. (wrapper castclass) System.Object.__castclass_withcache(object,intptr,intptr) Microsoft.MixedReality.SpectatorView.AssetCache1[TAsset].TryLoadAssets (System.String name) (at Assets/MixedReality-SpectatorView/SpectatorView/Scripts/StateSynchronization/AssetCache.cs:386) Microsoft.MixedReality.SpectatorView.AssetCache1[TAsset].GetAsset (Microsoft.MixedReality.SpectatorView.AssetId assetId) (at Assets/MixedReality-SpectatorView/SpectatorView/Scripts/StateSynchronization/AssetCache.cs:292) Microsoft.MixedReality.SpectatorView.TextMeshProService.GetFont (Microsoft.MixedReality.SpectatorView.AssetId assetId) (at Assets/MixedReality-SpectatorView/SpectatorView/Scripts/StateSynchronization/NetworkedComponents/TextMeshPro/TextMeshProService.cs:30) Microsoft.MixedReality.SpectatorView.TextMeshProObserverBase.Read (Microsoft.MixedReality.SpectatorView.INetworkConnection connection, System.IO.BinaryReader message) (at Assets/MixedReality-SpectatorView/SpectatorView/Scripts/StateSynchronization/NetworkedComponents/TextMeshPro/TextMeshProObserverBase.cs:53) Microsoft.MixedReality.SpectatorView.ComponentBroadcasterService`2[ServiceType,ObserverType].Read (Microsoft.MixedReality.SpectatorView.INetworkConnection connection, System.IO.BinaryReader message, UnityEngine.GameObject mirror) (at Assets/MixedReality-SpectatorView/SpectatorView/Scripts/StateSynchronization/ComponentBroadcasterService.cs:89) Microsoft.MixedReality.SpectatorView.StateSynchronizationSceneManager.ReceiveMessage (Microsoft.MixedReality.SpectatorView.INetworkConnection connection, System.IO.BinaryReader reader) (at Assets/MixedReality-SpectatorView/SpectatorView/Scripts/StateSynchronization/StateSynchronizationSceneManager.cs:263) Microsoft.MixedReality.SpectatorView.HologramSynchronizer.UpdateHolograms () (at Assets/MixedReality-SpectatorView/SpectatorView/Scripts/StateSynchronization/HologramSynchronizer.cs:70) Microsoft.MixedReality.SpectatorView.StateSynchronizationObserver.Update () (at Assets/MixedRea

chrisfromwork commented 4 years ago

During this failure, the kinect observer instance is trying to load an asset cache. Asset caches are the lookup tables that allow the broadcaster hololens app to tell the observer kinect player what content should be shown/updated/hidden.

Is it possible to see the name of the asset that is failing to load? It seems like this is a text mesh pro font that may be known on the hololens device, but that is not known by the kinect observer device, which would suggest that your asset cache is out of sync. Did you run Update all asset caches before building for HoloLens?

lust0yixiong commented 4 years ago

During this failure, the kinect observer instance is trying to load an asset cache. Asset caches are the lookup tables that allow the broadcaster hololens app to tell the observer kinect player what content should be shown/updated/hidden.

Is it possible to see the name of the asset that is failing to load? It seems like this is a text mesh pro font that may be known on the hololens device, but that is not known by the kinect observer device, which would suggest that your asset cache is out of sync. Did you run Update all asset caches before building for HoloLens?

Thank you, you are right. I didn't update the assets in Spectator project, now it works normal.

lust0yixiong commented 4 years ago

Plus: there is still a little problem: In my project, every time the unityeditor will crash when i update all assets. That does not affect the usage of project, but makes me confused.

chrisfromwork commented 4 years ago

im not sure what would cause this editor crash. If you attach a debugger to the unity editor executable you may be able to see what call stack is causing the crash.