microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6.01k stars 2.12k forks source link

Problem with MixedRealityInputSimulationProfile serialization #3971

Closed genereddick closed 4 years ago

genereddick commented 5 years ago

Overview

The error message below is showing up on a deploy to the WMR Headset (but not on HoloLens on the in the Unity editor). I've separated it from #3944.

From @lukastoenneMS's comment in #3944

The problem with the MixedRealityInputSimulationProfile seems to be that the data providers in InputSystem use a generic BaseMixedRealityProfile. When the standalone app is built the InputSimulation assembly is excluded since it's editor-only. The final type of the data provider's profile asset (MixedRealityInputSimulationProfile, 300 bytes) is then missing and the serialization interprets the asset as a BaseMixedRealityProfile (76 bytes).

@davidkline-ms is looking into it.


From #6054:

The DefaultMixedRealityInputSimulationProfile is part of the the simulation data provider in the MRKT input profile. But at the same time it's AMSDEF is Editor and UWP only, causing a deserialization problem on all other platforms. Since it's the only service (I think) that's only being used in Editor and the fact that it also compiles for UWP makes me believe that either this could very well be just compiled for all platforms and we're done with it, or the profile needs to be extracted out, which I tried and stopped after the 3rd file.

Expected Behavior

No error

Actual Behavior

Error message:

A scripted object (probably Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSimulationProfile?) has a different serialization layout when loading. (Read 76 bytes but expected 300 bytes) Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

Steps to reproduce

(Links to sample github project preferred)

Unity Editor Version

2018.3.12f1

Mixed Reality Toolkit Release Version

MRTK latest

david-c-kline commented 5 years ago

@genereddick, have you noticed any side effects other than the message in the debugger?

Currently working on a possible solution, just wondering if there are any ill effects.

genereddick commented 5 years ago

@davidkline-ms In addition to the head-locked (well, one cross-eyed eye-locked) error window Selection in app no longer works, but also can't even exit to the MR Portal homepage (so have to shutdown the MR Portal to get out) Can still look around, but screen is inconsistently frozen / distorted -- seems similar to the effects of extremely low frame rate jerkiness

genereddick commented 5 years ago

@davidkline-ms I don't see a recurring error message, so once it hits the MixedRealityInputSimulationProfile error that gets logged but there is nothing else getting logged on each frame or whatever.

The above error message shows up even before the app is fully loaded, at least the error message is there the moment the app is loaded. A second error message shows up after the one above and after the app is loaded:

Exception thrown at 0x74B733D2 (KernelBase.dll) in ...exe: 0x40080202: WinRT transform error (parameters: 0x8000000B, 0x80070490, 0x00000014, 0x0332E0A0). The thread 0x298c has exited with code 0 (0x0). The thread 0x59c has exited with code 0 (0x0). The thread 0x59ac has exited with code 0 (0x0). '....exe' (Win32): Loaded 'C:\Windows\SysWOW64\msxml6.dll'. [50.373536 / 54.968188] - OnWindowActivated event - Deactivated. onecoreuap\windows\wgi\winrt\display\displaycommon.cpp(411)\Windows.Graphics.dll!7C3B44D2: (caller: 7C3B41D6) ReturnHr(7) tid(5cbc) 80070490 Element not found. Windows Mixed Reality spatial locatability state changed to Inhibited.

genereddick commented 5 years ago

On a related note, it would be nice if the error window was actually visible -- would be easier to log a bug report without having to run in debug mode. The error window appears in only one eye and partially off screen (visually over my nose) and extremely close to my face.

I'm running in Single Pass instanced mode. (but maybe this is a WMR headset issue)

david-c-kline commented 5 years ago

Thanks @genereddick! I am currently working on resolving the simulation profile serialization issue.

Will have to look into the WinRT transform error.

The spatial locatability stage being Inhibilited is a runtime message regarding experience scale (seated, room scale, etc) / boundaries and should not be a concern.

genereddick commented 5 years ago

This is marked as closed but I still have the same error (using code as of this morning).

A scripted object (probably Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSimulationProfile?) has a different serialization layout when loading. (Read 76 bytes but expected 300 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
lukastoenneMS commented 5 years ago

This should fix it: #4112

keveleigh commented 5 years ago

Reopening this original issue for tracking, and marking the others as duplicates.

mmskrzyn commented 5 years ago

Experienced this problem with the MRTK v2.0.0 RC1 Refresh in Unity 2018.4.1f1.

My app runs as expected except for the Unity debug console showing up in one eye with the noted error message (however, mine says "Read 76 bytes but expected 288 bytes" instead of 300 bytes).

Interesting Note: The unity debug console disappears when a hand model is rendered and reappears when a hand model is not.

@TobiahZ

Alexees commented 5 years ago

I'd like to add that the InputSimulation Service seems to be the only service that let's you move WASD style, which is the most convenient way on Windows Standalone. I know the Toolkit is about VR/AR/MR, but since Windows, as a platform, is available, and nothing really prevents you from building a standalone app, why not making it properly available? Spectators are always nice. I'm talking about networked solutions here.

stale[bot] commented 4 years ago

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

keveleigh commented 4 years ago

This should be fixed by #7018, since this script is now in an assembly that's marked for all platforms:

image