....is inaccessible due to its protection level?

Hello,

I’m trying to create a powerup item in a 2d infinite runner that slows the players speed by 1%. (I’m using unities sample asset 2d character controller)

using this code I get the following error

PlatformerCharacter2D.DecreaseSpeed(float) is inaccessible due to its protection level.

public class PowerUpScript : MonoBehaviour {

    HUDScript hud;
    PlatformerCharacter2D power;

    void OnTriggerEnter2D(Collider2D other)
    {
        if(other.tag == "Player")
        {
            hud = GameObject.Find("Main Camera").GetComponent<HUDScript>();
            hud.IncreaseScore(10);
            power = GameObject.Find("2D Character").GetComponent<PlatformerCharacter2D>();
            power.DecreaseSpeed(0.1);
            Destroy(this.gameObject);
        }
public class PlatformerCharacter2D : MonoBehaviour

public float maxSpeed = 1000f;

  void DecreaseSpeed(float minusSpeed)
    {
        maxSpeed -= minusSpeed;
    }
  
    }

Anybody got any ideas? Help appreciated!

Make the method public.

I was unaware that I could do that! Thank you very much. This fixed the issue.