- Home /
Question by
maltakereuz · Feb 22, 2019 at 08:59 AM ·
prefabcopyprogrammaticallycopy-paste
copy paste prefab programmatically
I have an instance of prefab in scene. I want to create 100 copies (from data-table) and of course i do not want to do it by pressing ctrl+D 100 times. How can i doublicate or copypaste an object in scene from my C# script?
Comment
Answer by Happeloy · Feb 22, 2019 at 09:54 AM
You can instantiate prefabs (or copy existing game objects) with Instantiate(prefab);
It takes a range of different arguments other than the gameobject itself, such as position, rotation etc. Check the docs here: https://docs.unity3d.com/ScriptReference/Object.Instantiate.html