private void DestroyBlock() { gameStatus = FindObjectOfType <GameSessionScript>(); AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position, 1f); level.DestroyBlock(); gameStatus.AddToScore(); TriggerSparklesVFX(); Destroy(gameObject); //this is how i wanted to do it, apparently im missing something //use gameObject instead of this /* * if (collision.collider.name == "Ball") * { * Destroy(this); * } */ }
// Start is called before the first frame update void Start() { field_text_scoreDisplay = GetComponent <Text>(); field_gameSessionScript = FindObjectOfType <GameSessionScript>(); }