Hey guys as work this Script? I need make an object appears by pressing “T”, Sorry the bad english i Speak spanish, Greetings to all!
public Mesh objectToCreate;
void Update()
{
if(Input.GetKeyDown("T"))
{
var gameObject = new GameObject("Some Name Here");
var meshFilter = gameObject.AddComponent<MeshFilter>();
gameObject.AddComponent<MeshRenderer>();
meshFilter.sharedMesh = objectToCreate;
gameObject.transform.position = transform.position;
gameObject.transform.rotation = transform.rotation;
}
}