Pass Enum To Function Parameter


On one script I have a enum variable, and I want to send the enum in a SendMessage as a parameter to another script, like so:

Weapon Object

// ----- Weapon Pickup ----- \\
enum selectWeapon {Gun, LargeGun}
var typeOfPickup : selectWeapon;

function OnCollisionEnter(hit : Collision){
   hit.collider.SendMessageUpwards("changeWeapon", typeOfPickup, SendMessageOptions.DontRequireReceiver);

And on my player

// ----- Player / Receiver ----- \\
function changeWeapon(weapon : ???) {
   if(currentWeapon == weapon.Gun){
      //do something


Any ideas how I can do this?


I tried to make a parameter of type _try(enum) and also int both worked for me. the below is the code. casting it to int would definitely work. Also i remember enum not working properly for if loops on another sciprts (in unity script), so used to follow casting to int method.

  public class enumChecker : MonoBehaviour {
	_try obj=_try.blah;
	// Use this for initialization
	void Start () {
		haha ((int)obj);
	// Update is called once per frame
	void Update () {
	void haha(int  temp)

public enum _try

You should be able to use selectWeapon as the type, as far as I can see. Is that not working?