How to have an array that is visable in the editor

I am working on a script that atomaticly instantiates some GameObjects when I start it, but I need a way of looping though the GameObjects and their additional aspects. Things I de have set up is a function that spawns a GameObject given the variables: Vector2Int position, int rotation, GameObject preset, Transform center with the eventual position being Vector3 (position.x, 0, position.y) and rotation being Quaternion.Euler(0, rotation * 90, 0). Now I want to add a list (or array or whatever works better) visable and edditable in the edditor that will contain an entry for every object with all the information needed to spawn it in. The line that calles the aformentionned function looks like this ShapeGen.generatePlayerComponent(item.position, rotation, part, player.transform).transform.parent = player.transform;.

Hi,

You need to wrap all those thing into a class (with attribute Serializable) like so:

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

public class SampleClass : MonoBehaviour
{
    public List<SpawnObject> SpawnObjects = new List<SpawnObject>();

    [Serializable]
    public class SpawnObject
    {
        public Vector2Int Position;
        public int Rotation;
        public GameObject Preset;
        public Transform Center;
    }
}

If you add this script to your object you will have editable and visible list.