Did it a bit differently and I need a bit of help

I made so that the Spawner parent game object managed the waves (using scriptable objects).

But then I remarked that my attackers were still spawned to the attackers parent gameobject, instead of the lanes (children of spawner parent game object). I needed to change my spawndirector script, like this:

public class SpawnDirector : MonoBehaviour
{
    public SpawnQueue Queue;
    // Use this for initialization
    void Start()
    {
        if (!Queue)
        {
            Debug.LogError("SpawnQueue is missing in: " + name);
            return;
        }

        foreach (Spawn item in Queue.SpawnsList)
        {
            StartCoroutine(Spawn(item));
        }
    }    

    IEnumerator Spawn(Spawn spawnData)
    {
        yield return new WaitForSeconds(spawnData.SpawnTimeAfterQueueHasStarted);
        GameObject spawnedAttacker = Instantiate(spawnData.PrefabToSpawn);
        spawnedAttacker.transform.parent = spawnData.PositionToSpawnTo;
    }
}

My attackers get spawned but at 0,0 because:
“Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.
UnityEngine.Transform:set_parent(Transform)
c__Iterator0:MoveNext() (at Assets/Scripts/SpawnDirector.cs:27)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)”

Any idea on how to fix this?

It is to note the following, here’s an instance of the scriptable object I’m using:
http://imgur.com/KN3aDLN

The position to spawn is actually the children of the spawners prefab (laneX). Would that be the problem? And if yes, how else could I do what I want to do?

Adding the other classes here, I still don’t get how I can do like in the video, what’s the issue?

[CreateAssetMenu(fileName ="newSpawnQueue", menuName ="Glitch Garden/Spawn Queue")]
public class SpawnQueue : ScriptableObject
{
    public Spawn[] SpawnsList;
}

using UnityEngine;

[System.Serializable]
public class Spawn
{
    public float SpawnTimeAfterQueueHasStarted;
    public GameObject PrefabToSpawn;
    public Transform PositionToSpawnTo;
}


OK, I guess using objects, instances and/or prefabs isn’t a good idea for scriptable objects. Changed that last field in spawn by a string suffix. The Spawners object has a prefix on its script and the GameObject.Find takes care of finding the adequate parent to stick the enemy to. :stuck_out_tongue:

Having the same problem too. Don’t know why this is an issue in 5.65 and not whatever version Ben is using. I found this issue goes back to 2012, which is confusion version wise. It’s making me wonder if I’ve done something wrong.

EDIT: Although i get the error, the axe and cucumber are spawned from the gun, which is a prefab, and from its altered position. Weird.