- Home /
Question by
jayesh4520 · Jan 27, 2018 at 05:31 PM ·
swap
i want to swap prefab before it instantiate
how can i swap i know how to instantiate i have 5 prefab i wanna swap randomly each time it instantiate
Comment
You can set the position of an object via its transform:
https://docs.unity3d.com/ScriptReference/Transform-position.html
For random things, you have two options; you can use Unity's built-in random number generator, which requires slightly less setup, or you can use C#'s Random class, which is more powerful and can be extended
https://docs.unity3d.com/ScriptReference/Random.html
https://msdn.microsoft.com/en-us/library/system.random(v=vs.110).aspx
Your answer
![](https://koobas.hobune.stream/wayback/20220612151415im_/https://answers.unity.com/themes/thub/images/avi.jpg)