Hi, i need to change values of scripts from another scripts, this is what i have written. Code (CSharp): public Score putos; putos = GetComponent<Score>(); putos.active = true; But the console sends me this message: Code (CSharp): NullReferenceException: Object reference not set to an instance of an object Stone.OnTriggerEnter2D (UnityEngine.Collider2D other) (at Assets/Scripts/Mainly/Player/Stone.cs:45) any idea of what can i do?
GetComponent is on the Object that the script exist on.. aka if u want to use GetComponent like that Score needs to be on the object your calling the it on.