Hi
I have a script(dashboard) and has a variable named Speed, and i want to access that from this script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RPM_Color : MonoBehaviour {
private Dashboard x;
void Start () {
Dashboard x = GetComponent<Dashboard> ();
}
void Update () {
Debug.Log (x.speed);
}
}
the console says:
NullReferenceException: Object reference not set to an instance of an object
RPM_Color.Update () (at Assets/_Scripts/RPM_Color.cs:17)
how can i fix this?
I know that so many of this kind of questions has been asked by people , but i dont understand even single one of them ! i’m new to C# please be clear and simply explain what is going on here with damn c#
THANX BY THE WAY !