Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class CoinController : MonoBehaviour {
- public GameObject coin;
- public int coinCount;
- public float spacing;
- void Start () {
- SpawnCoins ();
- }
- void SpawnCoins () {
- for (int i = 0; i < coinCount; i++) {
- Vector3 spawnPosition = new Vector3 (transform.position.x,transform.position.y + 1,transform.position.z + i *spacing);
- Instantiate(coin, spawnPosition, Quaternion.identity);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement