コード例 #1
0
    void CreatePlayer()
    {
        playerIsCreated = true;
        GameObject newPlayer = Instantiate(playerSO.prefabs[0], transform.position, Quaternion.identity);

        playerSO.createdObjects.Add(newPlayer);
        playerSO.InitialInstantiateObject();
    }
コード例 #2
0
    void CreateAndSetObject(SpawnObject so)
    {
        // go through all prefabs
        for (int j = 0; j < so.repeatingObject; j++)
        {
            // many times
            for (int i = 0; i < so.prefabs.Length; i++)
            {
                // create instance
                GameObject createdObject = Instantiate(so.prefabs[i], so.spawnPoint.position, Quaternion.identity);
                so.createdObjects.Add(createdObject);
                createdObject.transform.SetParent(spawnHolder);
            }
        }
        // Change scale all created objects
        // give created object individual number and reference to script

        so.InitialInstantiateObject();
    }