Problem with opening the code actions menu

Hey,
I want to define the “Touch” object as for the UnityEngine.InputSystem.EnhancedTouch, but when I press “control+.” it says there are no code actions available.
Anyone knows maybe why thats happening and how can I solve it? Because when the compiler tries to compile the script on Unity it gives me the error of “‘Touch’ is an ambiguous reference between ‘UnityEngine.InputSystem.EnhancedTouch.Touch’ and ‘UnityEngine.Touch’”.
Thank you.

I don’t know about your code actions, but at the top of the script you should see a using UnityEngine.Touch; line. If you want to use UnityEngine.InputSystem.EnhancedTouch, you can delete that line

I don’t have the using UnityEngine.Touch; line but I do have the using UnityEngine.InputSystem.EnhancedTouch; and the using UnityEngine; ones which I need.
The Touch doesn’t know to which of them it suppose to be related and I don’t know how to do it.

Yeah sorry, I looked at it wrong. Unfortunately you cannot remove the UnityEngine line. You would have to explicitly reference the enhanced Touch by using UnityEngine.InputSystem.EnhancedTouch.Touch whenever you refer to it. If you do it a lot, you could alias the namespace like this

using enhanced = UnityEngine.InputSystem.EnhancedTouch;

// now reference like this
enhanced.Touch touch;

In the course, Nathan uses

using Touch = UnityEngine.InputSystem.EnhancedTouch;

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms