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

ToRole<TRole> constantly returns "Invalid"

Open ValakhP opened this issue 9 years ago • 2 comments

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.

ValakhP avatar Apr 06 '17 07:04 ValakhP

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.

lawwong avatar Apr 06 '17 11:04 lawwong

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

ValakhP avatar Apr 06 '17 12:04 ValakhP