Vrtk: Controllers not interacting with the UI in WindowsMR UWP Build ( Works fine in the editor playmode)

Created on 30 Aug 2018  路  9Comments  路  Source: ExtendRealityLtd/VRTK

Environment

  • Source : Github
  • Version of VRTK : 3.3.0
  • Version of Unity3D : 2017.4.8, 2017.4.10
  • Hardware used : WindowsMR Device
  • SDK used : UWP,

Steps to reproduce

  1. Add a world space canvas with VRTK_UICanvas Attached to it.
  2. Add some UI elements to the canvas
  3. Check if the UI is interactive with the controller in editor ( It works without any issues in editor)
  4. Build a UWP app and try interacting with the UI using the controller ( The UI is not interacting in the build)

Expected behavior

The controller should interact with the UI elements in the canvas as it does in the editor playmode

Current behavior

In the UWP build the the canvas elements are not interacting with the controller. It works fine in the editor.

Most helpful comment

@rockwalrus and I were able to resolve this problem. We tracked the issue down to VRTK_UIPointer.OnEnable() > ConfigureEventSystem() > SetEventSystem(cachedEventSystem). If the Event System passed in isn't a VRTK_EventSystem, the component gets added. Within VRTK_EventSystem.OnEnable(), CopyValuesFrom() iterates through all the properties on the current Event System and copies them to the new VRTK_EventSystem. This is where the issue was occurring, specifically in regards to the hideFlags property.

It turns out that Unity automatically performs managed bytecode stripping when you use the IL2CPP scripting backend. Because the property names are not explicitly mentioned in CopyValuesFrom(), the hideFlags property was being erroneously stripped. Following the instructions in the Unity Manual article I just linked, we added a link.xml file to our project as follows:

<linker>
    <assembly fullname="UnityEngine.CoreModule">
        <type fullname="UnityEngine.Object" preserve="all">
        </type>
    </assembly>
</linker>

This resolved our problem; UI functions properly in built versions of our application.

All 9 comments

@bddckr @thestonefox Please let me know if there is any workaround to fix this immediately, I am about to complete a project which has lot of UI interactions. Unfortunately I hadn't tried building the project before. Thanks!

Your best bet to get help is the VRTK Slack because you can instantly get answers instead of waiting on here. It's also way easier for troubleshooting in general.

I am having this issue as well. Here is a possible workaround, haven't tried it yet.

@rockwalrus and I were able to resolve this problem. We tracked the issue down to VRTK_UIPointer.OnEnable() > ConfigureEventSystem() > SetEventSystem(cachedEventSystem). If the Event System passed in isn't a VRTK_EventSystem, the component gets added. Within VRTK_EventSystem.OnEnable(), CopyValuesFrom() iterates through all the properties on the current Event System and copies them to the new VRTK_EventSystem. This is where the issue was occurring, specifically in regards to the hideFlags property.

It turns out that Unity automatically performs managed bytecode stripping when you use the IL2CPP scripting backend. Because the property names are not explicitly mentioned in CopyValuesFrom(), the hideFlags property was being erroneously stripped. Following the instructions in the Unity Manual article I just linked, we added a link.xml file to our project as follows:

<linker>
    <assembly fullname="UnityEngine.CoreModule">
        <type fullname="UnityEngine.Object" preserve="all">
        </type>
    </assembly>
</linker>

This resolved our problem; UI functions properly in built versions of our application.

@beccannlittle @rockwalrus Thanks for figuring this out!

Unity states one can put the link file in the Assets folder directly or any subdirectory of Assets, so I believe we should be able to ship it with VRTK, though I wonder what happens if you have multiple link files.

Is anyone of you able to check whether multiple link files in a project work?

Thanks again!

@bddckr from that Unity Manual page:

A project can include multiple link.xml files. Each link.xml file can specify a number of different options.

@beccannlittle : Thanks for sharing. It was really helpful. You are a life saver!

Damn I totally didn't see that. I need a vacation 馃槄

Thanks for sharing, will try to get that in soon.

Closing this as it's related to an older version of VRTK (v3.3) the master branch is now on VRTK v4. Feel free to request to reopen if the issue is still present.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

monodavids picture monodavids  路  3Comments

cameronoltmann picture cameronoltmann  路  6Comments

garytyler picture garytyler  路  5Comments

aantn picture aantn  路  7Comments

xEvoGx picture xEvoGx  路  7Comments