Question by
PaincideStudio · Feb 12, 2018 at 02:54 PM ·
objectrandomspawnrandom.range
Random Object Spawn
Hi!
I'm trying to make a object spawn on the random furnitures(desk,chair,closet etc).
I made object spawn on the random position, but I want the object spawn on the placed furnitures
randomly.
Help me plz!
Here is the script for random spawn postion
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandomObjectSpawn : MonoBehaviour {
float x;
float y;
float z;
Vector3 pos;
// Use this for initialization
void Start ()
{
x = Random.Range (-5, 5);
y = -7.8f;
z = Random.Range (-5, 5);
pos = new Vector3 (x, y, z);
transform.position = pos;
}
// Update is called once per frame
void Update () {
}
}
Comment