access enum value ( in csharp but not mandatory)

Hi,

I would like to access the actual value of the enum I declared. I fear this is against good practice, but I'll ask anyway :) The example below is in cSharp, but I would be glad to hear solutions for other languages as well.

public enum mouseLookTrigger { AlwaysOn = -1, LeftMouse = 0, MiddleMouse = 2, RightMouse = 1 }
public mouseLookTrigger trigger = mouseLookTrigger.LeftMouse;

basically, it start to make sense here because I could directly inject the actual value in

Input.GetMouseButton(trigger);

but that doesn't work, I get

error CS1503: Argument 1: Cannot convert type `MouseLook.mouseLookTrigger' to`int'

So, How can I access the value `0` if `trigger` is equal to `mouseLookTrigger.LeftMouse` ? else, what would be the preferred way to get around such problem and script good practices?

Thanks,

Jean

1 Answer

1

(int)trigger should do it

that works yes, thanks Mike.