private void SpawnCandy() { var candyObject = Instantiate(candyPrefab, transform.position, transform.rotation); Candy candyScript = candyObject.GetComponent <Candy>(); candyScript.SetCandy(selectedCandy); audioSource.PlayOneShot(dropAudioClip); candyTimer = timeBetweenCandy; }