The script is attached to a coin that when picked does that issue. There is nothing to attach in the inspector.
The CoinMagnet state
is assigned to another object (as a magnet).
public void Start()
{
Player = GameObject.FindGameObjectWithTag("Player");
pu = Player.GetComponent<PowerUps>();
}
private void Update()
{
if (pu.CurrentPowerState == PowerUps.State.CoinMagnet) //issue here
{
if (Vector3.Distance(Player.transform.position, transform.position) < CoinMagnetRadius)
...
...
}
}
Here is the Powerups class
public State CurrentPowerState;
public enum State
{
None,
Invincible,
CoinMagnet,
};