ViveSoftware / ViveInputUtility-Unity

A toolkit that helps developing/prototyping VR apps.
http://u3d.as/uF7
Other
358 stars 81 forks source link

ToRole<TRole> constantly returns "Invalid" #6

Closed ValakhP closed 7 years ago

ValakhP commented 7 years ago

When using ViveRoleProperty.ToRole<TRole>(), it returns Invalid everytime.

I guess, that the problem is in line 167: if (m_roleType != typeof(TRole) || roleInfo.TryGetRoleByName(m_roleValueName, out role))

You have m_roleValueName parameter in method that is getting the role from Dictionary. After replacing it with m_roleTypeFullName everything works fine.

lawwong commented 7 years ago

Thanks, I actually missed a negation operator. It should be if (m_roleType != typeof(TRole) || !roleInfo.TryGetRoleByName(m_roleValueName, out role)) meaning that returns invalid if role type not match or the value string not found in roleInfo.

ValakhP commented 7 years ago

Oh, yeah. My bad. Anyway nice to have it fixed.