public void OnCoinClicked() { // Instantiate the CoinPoof Prefab where this coin is located // Make sure the poof animates vertically // Destroy this coin. Check the Unity documentation on how to use Destroy Instantiate(CoinPoofPrefab, CoinPosition.position, CoinPosition.rotation); mySignPost.IncrementCoinCount(); //update count for signpost //Play sound on Click coinAudioSource.Play(); Destroy(this.gameObject, coinAudioSource.clip.length); }
public void OnCoinClicked() { resultSignClass.IncrementCoinCount(); puffSound.Play(); Vector3 coinPosition = transform.position; Object.Instantiate(puffObject, coinPosition, Quaternion.Euler(-90, 0, 0)); Destroy(this.gameObject); // Instantiate the CoinPoof Prefab where this coin is located // Make sure the poof animates vertically // Destroy this coin. Check the Unity documentation on how to use Destroy }