Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question array in the VS inspector

Discussion in 'Visual Scripting' started by xbi21, Jun 11, 2022.

  1. xbi21

    xbi21

    Joined:
    Jun 11, 2022
    Posts:
    5
    I am trying to create a string array in the inspector, unfortunately i always get:

    No inspector for 'Compare Types'

    In my main class I do:

    Code (CSharp):
    1.         [Inspectable, Serialize, InspectorLabel("State")]
    2.         public CompareTypes[] types;
    and in the CompareTypes I have:

    Code (CSharp):
    1. public class CompareTypes
    2. {
    3.     public string name;
    4.     public bool amount;
    5. }
    How can I load an array in the VS inspector?
     

    Attached Files:

  2. marcuslelus

    marcuslelus

    Joined:
    Jun 18, 2018
    Posts:
    66
    I would think it's simply because your class can't be serialized. Just add [Serializable] over your class CompareTypes
     
  3. xbi21

    xbi21

    Joined:
    Jun 11, 2022
    Posts:
    5
    Thanks a lot Marcus!