U
U
Uncle Bogdan2021-10-12 21:02:14
Unity
Uncle Bogdan, 2021-10-12 21:02:14

How to set the position of the prefab that will spawn?

There are several levels. On some levels, objects should spawn in certain positions. Levels are NOT scenes, there is a generator script that dynamically generates them. How to do it?

I wrote this code, but since the object is a prefab, I cannot drag the desired empty from the scene.

[System.Serializable]
class SpawnObject
{
    public GameObject Object;
    public Transform Position;
}

    [SerializeField] private SpawnObject[] _objectsToSpawn;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question