Assigning custom complex objects via Inspector

I’m working on a project where many GameObjects have a script called Scannable. Scannable has a public Pictogram array. I have a definition for the Pictogram class, which has two properties. While each item with this script will have common behavior (thus the one script), the values of each Pictogram’s properties will vary. In this case, I’d simply like to keep the Pictogram array public so I can assign individual Pictograms to each instance of the object via the Inspector. This would save me the trouble of repeating the code for each object that relies on the bar script’s behavior. However, because Pictogram is not a native type in Unity, I’m uncertain how else to assign the properties. When I look at an item with the Scannable script component, it lets let me set the size of the array, and the Inspector UI clearly calls for a Pictogram in each element, but I’m unsure how to define these Pictograms in a way that would allow me to assign them via the Inspector.

Is this a pipe-dream? Will I have to write a separate version of the Scannable script just to have various instances of the Pictogram class?

Not a pipe dream at all, custom types can be serialized just as well as any other type, you just have to make sure that the type itself is marked as serializable, then unity will follow the same rules for its variables (anything public or marked as serialzied can be set in the inspector if its a valid serializable value/type).

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

public class Test : MonoBehaviour
{
    [System.Serializable]
    public class MyData
    {
        public int publicVarible;
        [SerializeField]
        private string privateVariable;
    }


    [SerializeField]
    private MyData[] myArray;
}

Drop that on an item in your scene and you’ll see how you can set the array size, and see/edit the contents of the items within that array.

EDIT: Credit to @RobAnthem for making a point I completely ignored, so I’ll comment on it here for anyone that finds this in the future.

If all you’re interested in is having an inspector for the data, making a MonoBehaviour to house it in it a terrible plan, If that’s your goal, then ScriptableObjects are the way to go, all the benefits of the inspector view plus all the fancy extras like better data securtiy (stored as assets instead of part of an object in the scene) ability to reuse and share among multiple objects in your scenes (no one wants duplication), and it’s easier to then write editor tools to find, filter/modify these assets when they are assets and not arbitrary data on a MonoBehaviour somewhere in a specific scene.