MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

MarkerDetectionHololens reference is null on NewDeviceDiscovery (SpectatorView)

Open benzben opened this issue 8 years ago • 11 comments

Does this affect the legacy HoloToolkit (master) or the Mixed Reality Toolkit (mrtk_release)? HoloToolkit

Describe the bug I'm trying to get the SpectatorView Preview running, but I'm having several errors like the one in the title. Unity gives me these errors:

grafik

To Reproduce I just followed the steps on: https://docs.microsoft.com/en-us/windows/mixed-reality/spectator-view

Actual behavior I can't build neither for Hololens nor for iPhone

Unity Editor Version 2018.1.0f2

Additional context Also in the inspector panel looking at the SpectatorView prefab, the NetworkManager seems to be empty: grafik

benzben avatar Oct 31 '18 13:10 benzben

edited issue to reflect that this is in HoloToolkit.

david-c-kline avatar Nov 01 '18 18:11 david-c-kline

@benzben Unity 2017.2.1p2 is the officially supported version but has been tested up to 2017.4.9

danielescudero avatar Nov 01 '18 21:11 danielescudero

If you use the prefab provided, those null references will be prefilled for you. I believe the source of this issue is that those public reference properties do not appear in the editor for the NewDeviceDiscovery and SpectatorViewNetworkDiscovery scripts due to the way the editor handles dervied classes that aren't derived from MonoBehaviour.

Another method to handle this is to edit the NewDeviceDiscovery and SpectatorViewNetworkDiscovery scripts to use the FindObjectOfType<>() function in their Awake() callbacks to find the respective references.

MrGuy avatar Nov 02 '18 03:11 MrGuy

@MrGuy I can't use the Awake() function as it's not a MonoBehaviour Script, right?

Also I noticed that the SpectatorViewNetworking.prefab I'm using doesn't have the 'NetworkManager' GameObject that appears in this tutorial (https://docs.microsoft.com/en-us/windows/mixed-reality/spectator-view) untitled Where do I find this component?

benzben avatar Nov 08 '18 06:11 benzben

Ah, right - You can't use the Awake function there. There is a portion of those scripts which detect the null references and prints those errors. You could use the FindObjectOfType<>() there to find the objects. Alternatively, you could just use the Start() callback.

I think the network manager script has been moved on to the SpectatorView > Shared > Networking object.

MrGuy avatar Nov 08 '18 07:11 MrGuy

@danielescudero I just installed Unity 2017.3 for testing and I get the exact same errors.

@MrGuy "I think the network manager script has been moved on to the Shared > Networking object." When I search in my Assets for 'NetworkManager' it does not find anything except 'SpectatorViewNetworkManager.cs'. I will try the idea of using FindObjectOfType now, but somehow I doubt that this will result in success. Something's just really messed up in my configuration, but I just can't figure it out. I downloaded the newest Git Repositories, so this should not be the problem.

benzben avatar Nov 08 '18 07:11 benzben

Here is the component the Network Manager was loaded on for me: image

Note that the NewDeviceDiscovery and SpectatorViewDiscovery scripts were already included in the SpectatorView prefab, no need to drag in the extra SpectatorViewNetworking prefab.

MrGuy avatar Nov 08 '18 07:11 MrGuy

Yeah sure, these components I have too, but as I posted in this reply (https://github.com/Microsoft/MixedRealityToolkit-Unity/issues/3042#issuecomment-436892261), the SpectatorViewNetworking.prefab seems to lack a component 'NetworkManager'. Also I have to point out that I get all these errors even before trying to hit play or build, they appear as soon as I drag the prefabs into my scene.

benzben avatar Nov 08 '18 07:11 benzben

I deleted the SpectatorViewNetworking prefab in my scene as you said and tried to build, then Unity gives me these errors: grafik Again I have the missing 'NetworkManager' on SpectatorView and some errors regarding the QRTracker...

benzben avatar Nov 08 '18 08:11 benzben

Regarding this issue (https://github.com/Microsoft/MixedRealityToolkit-Unity/issues/3040) I solved the problems with the QR Tracker. However, again I can't build as I get the errors grafik

benzben avatar Nov 08 '18 08:11 benzben

Okay, so this very issue (MarkerDetectionHololens reference is null on NewDeviceDiscovery) is actually solved by using FindObjectOfType for every component in the Awake function (there actually ARE awake functions, I just missed them because I was blind...). This issue may be closed, I will continue in another specific issue.

benzben avatar Nov 08 '18 08:11 benzben