Manager object containing a list of prefabs?

To transition from an overworld to a battle scene with enemies inside, i have an object named Manager, in a scene named Manager, which stays loaded using loadscenemode.additive whenever the scene is transitioned. The idea is that whenever a battle is started, whatever started it sends a prefab on the enemy into an array in the manager, which is then referenced by the battle scene to instantiate the enemies from that array. The problem is that in the script that starts the battle, attempting to assign a prefab to ManagerReference.enemylist throws the error “Assets\Scripts\testTele.cs(13,16): error CS1061: ‘GameObject’ does not contain a definition for ‘enemylist’ and no accessible extension method ‘enemylist’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)” in console. Here is the script that starts the battle.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class testTele : MonoBehaviour
{
    public GameObject ManRef;
    public GameObject myprefab;

    private void OnTriggerEnter2D(Collider2D collision)
    {
        ManRef.enemylist = myprefab;
       
        SceneManager.UnloadSceneAsync("SampleScene");
        SceneManager.LoadSceneAsync("Battle", LoadSceneMode.Additive);
      
    }
    // Start is called before the first frame update
    void Start()
    {
        ManRef = GameObject.Find("Manager");
    }

}

bump for visibility

The GameObject class doesn’t have an enemyList variable. You probably mean to do so on one of its components. Google for GetComponent if that is the case for how to use it.

thank you very much, thats so basic i cant believe i forgot it! :hushed: