unity instantiate an object
// Instantiates 10 copies of Prefab each 2 units apart from each otherusing UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour
{
public Transform prefab;
void Start()
{
for (int i = 0; i < 10; i++)
{
Instantiate(prefab, new Vector3(i * 2.0F, 0, 0), Quaternion.identity);
}
}
}
// You can use the 'Instantiate()' function to clone a GameObject
clone = Instantiate(original);
// You can also set the position, rotation and parent
clone = Instantiate(original, new Vector3(0, 0, 0), Quaternion.identity, cloneParent.transform);
Also in C#:
- convert double to currency c#
- c# aspx return image
- : ? conditioanl statement c#
- c# exit for
- whats a string
- wpf c# select folder path
- c# prime factorization
- xarray: create 2d dataset
- JavaScriptSerializer() and convert to base64
- test how catch exception c#
- c# get enum in list
- c#if
- c# region tag
- c# skip following code in loop
- unity gameobject.find
- for c#
- console.writeline
- for each textbox c#
- c# filter non alphanumeric characters
- read embedded resource c# xml
- postasync c# returns null
- switch case c# range
- how to pass object as test case in nunit c#
- unity collider2d contains point