Standard Assets: Change JumpForce of player from custom script

I have a powerup script and wanted to apply a jump boost when the player hits a particular powerup.

I have tried the following…

void OnTriggerEnter2D (Collider2D other)
    {
        if (other.tag == "Player") {
            switch (PointType.ToString ()) {
              //Removed unneeded cases for the forum post

              case "ReverseGravity":
                print ("flip it");
                other.transform.Rotate(new Vector3 (0, 0, 180f)); //works
                other.GetComponent<SpriteRenderer>().flipX = true; //works
                other.GetComponent<Rigidbody2D>().gravityScale = -10f; //works

                other.GetComponent<PlatformerCharacter2D>().m_JumpForce = 800f; //fails to build without errors - It says the component is out of context
                break;
            }
        }

Im not super versed in c#. The above “JumpForce” is part of the standard assets package.

The script that controls JumpForce is PlatformerCharacter2D. I am able to set the value in the gui of the unity editor but not in the scripts.

It could be because PlatformCharacter2D has not been compiled by Unity, try moving it from standard assets folder (which if I remember right only compiles once when you load Unity rather than each code change).

Also worth seeing if you have other compiler errors in the project that could be blocking this from being compiled.

If not, worth posting more info about PlatformCharacter2D and that variable