- Home /
Question by
KUFgoddess · Nov 06, 2016 at 09:29 AM ·
3dpickupscollectible
Random Pickup Respawn Manager?(spawn pickups with the tag "PickUp" in random locations)
C#Only How could I set up a system to make my collectables/pickups spawn in random positions?
Also, how could I make a pickup spawn in random locations after the Player collects the pickup with the tag "PickUp"? Would I need to make a new script and call it something like Respawn Manager? If one could lead me in the right direction to understand this as well.
using UnityEngine;
using System.Collections;
public class Coin : MonoBehaviour {
public int value;
public float rotateSpeed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
{
gameObject.transform.Rotate(Vector3.up * Time.deltaTime * rotateSpeed);
}
}
void OnTriggerEnter(Collider other)
{
GameManager.instance.Collect(value, gameObject);
AudioSource source = GetComponent<AudioSource>();
source.Play();
}
}
Comment