Quantcast
Channel: Questions in topic: "clone"
Viewing all articles
Browse latest Browse all 508

Prefab clone not working

$
0
0
Hi everyone, Im very new to unity and I am trying to create 5 of the same game object using a prefab but for some reason it does not work. (http://docs.unity3d.com/Manual/InstantiatingPrefabs.html iv been using this) I have done all of the instructions (create cube, add rigidbody and drag it into the prefab) and the code in the script is as followed using UnityEngine; using System.Collections; public class multiboxes : MonoBehaviour { public Rigidbody boxR; // Use this for initialization void Start () { for (int i = 0; i < 5; i++) { Vector3 position = new Vector3 (Random.Range (-3.0f, 3.0f), Random.Range (-2.0f, 2.0f), -2.0f); Rigidbody boxclone = (Rigidbody)Instantiate (boxR, position, Quaternion.identity); } } // Update is called once per frame void Update () { } } I have also made sure that I dragged the prefab into the BoxR rigidbody. ![alt text][1] Any help will be very appreciated. [1]: /storage/temp/34725-prefab+data.png

Viewing all articles
Browse latest Browse all 508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>