I am just starting to program in Unity with C sharp and javascript, but this particular project is in c sharp. I’ve seen exactly how common this particular error is in the questions, so I am sorry if I’ve missed the appropriate answer somewhere.

I have been working on following along with Brackeys tutorials, and now that I have been through a couple, I’ve been wandering some with the code to see what I can do.

My goal is to create a power-up object that changes the force of a character’s jump. The item is created and I have it scripted, but a single line has given me about 4 hours worth of searching through answers to find something I can apply, and I feel like I’m either missing something or just being dumb.

My Script:

{ namespace UnityStandardAssets._2D
{ public class TestScript : MonoBehaviour {

void OnTriggerEnter2D(Collider2D PowerUp)
{
	GameObject Player = GameObject.Find ("Player");
	PlatformerCharacter2D = Player.GetComponent<PlatformerCharacter2D> ();
	PlatformerCharacter2D.m_JumpForce = 800;
}}}

Error:
(11,17) CS0131: The left hand side of an assignment must be a variable, property, or an indexer.

Extra Info:
I currently have m_JumpForce as a public static float on its own script on the character movement script, although I have tried solely public float and static float as well in my attempts to wiggle around this, and private will not let me pull the reference from another script.

Any help is appreciated. I feel like the problem is in the section:
PlatformerCharacter2D = Player.GetComponent ();

Is there a type that I can list for the script to fix this? Each time I try, it removes the JumpForce definition, which is necessary for the code.

This is a pretty simple fix. Where you are trying to assign:

PlatformerCharacter2D = Player.GetComponent ();

It looks like PlatformerCharacter2D is the name of the script class you are trying to create a temporary variable for. Since PlatformerCharacter2D is your custom data type, in this instance you have to name it so that the name can be referenced, no the class itself. Something like

 GameObject Player = GameObject.Find ("Player");
 PlatformerCharacter2D charScript = Player.GetComponent<PlatformerCharacter2D> ();
 charScript.m_JumpForce = 800;

should work.