Convert Network.ViewID to Int

Exactly what the title says. How do you do this in c#? I want to be able to get the viewID and get a int of it.

int shotShellID = shotShell.GetComponent<NetworkView>().viewID;

It keeps giving me an error:

Assets/Scripts/TankController.cs(69,17): error CS0029: Cannot implicitly convert type `UnityEngine.NetworkViewID' to `int'

Thanks for your help!

gameObject.GetComponent ().viewID.ToString()

returns “AllocatedID: 1234” (or another number)


gameObject.GetComponent <NetworkView>().viewID.ToString().Substring (13);

returns “1234” (or the respective number)


Convert.ToInt32 (gameObject.GetComponent <NetworkView>().viewID.ToString().Substring (13);)

returns 1234 (or the respective number) as an integer.