Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Error CS0101

$
0
0
I am not the best programmer, and I am trying to translate script from Js to C#, so please correct me on any mistakes I have made, but I created two scripts, one called PickUp, and one GameManager. I needed to access the same variable in each, because each time I run into PickUp, I want to update my score in GameManager, and send it to a UI/HUD. I keep getting a CS0101 error saying I already stated GameManager somewhere, but I checked and I didn't. Here are the scripts: PickUp: public class PickUp : MonoBehaviour { public Transform particle; private GameManager gameMan; void Start() { gameMan = GetComponent(); } void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Player")) { gameMan.currentScore++; Instantiate(particle, transform.position, transform.rotation); gameObject.SetActive(false); } } } GameManager: public class GameManager : MonoBehaviour { public float currentScore = 0; void OnGUI() { } void Update () { } } I am not done with the scripts yet, I just want to solve this error.

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>