How can I fix this UnassignedReferenceException error?

using UnityEngine;
using System.Collections;

public class SlowWall : MonoBehaviour {
	public GameObject Player;
	void Example (){
		Player = GameObject.Find("Player");
	}
	public float ShrunkenSlowDownPercentage = 0.6f;
	public float SlowDownPercentage = 0.8f;
	public float EnlargedSlowDownPercentage = 0.9f;
	void OnTriggerEnter(Collider other)
	{
	
		print("Collision detected with trigger object " + other.name);
		PlayerComponent playerComponent = other.gameObject.GetComponent<PlayerComponent> ();
		//checking if collided with player
		if (playerComponent) {
			if (Player.transform.localScale.magnitude < 0.9f){
				playerComponent.Speed *= ShrunkenSlowDownPercentage;

			}
			if (Player.transform.localScale.magnitude > 1.9f){
				playerComponent.Speed *= EnlargedSlowDownPercentage;

			}
			else{
				playerComponent.Speed *= SlowDownPercentage;

			}
			if (playerComponent.Speed < 30f){
				playerComponent.Speed = 30f;
			}
			Destroy (gameObject);
		}
	}

	
	void OnTriggerStay(Collider other)
	{
		print("Still colliding with trigger object " + other.name);

	}
	
	void OnTriggerExit(Collider other)
	{
		print(gameObject.name + " and trigger object " + other.name + " are no longer colliding");
	}

}

Okay so here’s the error
UnassignedReferenceException: The variable Player of SlowWall has not been assigned.
You probably need to assign the Player variable of the SlowWall script in the inspector.
SlowWall.OnTriggerEnter (UnityEngine.Collider other) (at Assets/Scripts/Obstacles/SlowWall.cs:19)

Now here’s the problem, the slowall script is for a generated object, so how can I get this generated object to atomatically assign my Player to it’s script?
Any help or advice is welcome and sorry, I’m new to programming.

The exception is telling you that you need to assign the Player variable to something, which is often done in the inspector by dragging the GameObject Player onto the variable “Player” in this script.

It’s also possible to set it in code, and you actually have code in place that does just that: The call to GameObject.Find(“Player”) which takes place in method Example(). Unfortunately, Example() is never called anywhere, so the variable remains unset.

Set the variable in the inspector and the error goes away.

PS: I took the liberty to edit your question in order to format your code correctly. Unity Answers often does a terrible job highlighting code automatically on pasting, and will frequently miss leading or ending braces, etc. Next time, mark the code manually after pasting and hit the “101010” button.