I’ve had this error before back in my Java days, but I can’t remember how to fix it. I’m getting a variable from another script, calling every frame like so:
static var currentWeapon = 1;
function Update()
{
currentWeapon = Player.GetCurrentWeapon();
}
and in the Player script
static var currentWeapon : int = 1;
function GetCurrentWeapon()
{
return currentWeapon;
}
Which throws:
Assets/UnityShooterEngine_1_6-1_WORKS/Assets/Scripts/Player/SwitchWeapons.js(11,42): BCE0020: An instance of type ‘BrennonFPSPlayer’ is required to access non static member ‘GetCurrentWeapon’.
Of course, I know what static is and means, so no need to trouble yourself with explaining the basics. ![]()