Cloning the GameObject Unity class

I want to clone in a script GameObject without it appearing on the scene(so Instantiate won't do)

    GameObject prefab = new GameObject();
    GameObject variant = // Волшебное клонирование prefab
    // Тут variant и prefab совершенно идентичны, но ссылаются на разные объекты
 0
Author: Andrew, 2019-11-29

1 answers

This turned out to be impossible, since when creating a new GameObject in any way, Unity adds it to the scene automatically.

 0
Author: Andrew, 2020-03-21 06:41:57