How to summon an object in unity?

Viewed 49

How can I summon an object in unity? I have a folder named Objects and there is an object I want to summon named RandomBeam and I want to summon it at -12.5, 0, 0.

-Thanks.

Unity2D

1 Answers

create variable in custom script public GameObject RandomBeamPrefab; (dont forget to drag and drop RandomBeam from folder to your components field named RandomBeamPrefab)

then use this Instantiate(RandomBeamPrefab, new Vector3(-12.5f, 0, 0), Quaternion.identity);

example here

Related