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

What is the problem?( Activator.cs(56,58): error CS0131: The left-hand side of an assignment must be a variable, a property or an indexer)

$
0
0
using System.Collections; using System.Collections.Generic; using UnityEngine; public class Activator : MonoBehaviour { SpriteRenderer sr; public KeyCode key; bool active = false; GameObject note; Color old; public bool createMode; public GameObject n; void Awake () { note = GameObject.Find ("GameManager"); sr = GetComponent (); } void Start () { old = sr.color; } // Update is called once per frame void Update () { if(createMode){ if (Input.GetKeyDown (key)) Instantiate (n, transform.position, Quaternion.identity); }else{ if (Input.GetKeyDown (key)) StartCoroutine (Pressed ()); if (Input.GetKeyDown (key) && active) { Destroy (note); AddScore (); active = false; } } } void OnTriggerEnter2D(Collider2D col) { active = true; if (col.gameObject.tag == "Note") note = col.gameObject; } void OnTriggerExit2D (Collider2D col) { active = false; } void AddScore() { PlayerPrefs.SetInt ("Score", PlayerPrefs.GetInt ("Score")=note.GetComponent()); } IEnumerator Pressed () { sr.color = new Color(0, 0, 0); yield return new WaitForSeconds (0.2f); sr.color = old; } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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