- Home /
How to make an array with different variables and visible in Unity's inspector
I do have make some array with different variable but the array is not visible to unity's inspector even I make it public variable. How to make it visible?
here is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class test : MonoBehaviour
{
public Droid[] DroidData;
public class Droid
{
public string Name;
public float Durability;
public float Firerate;
public int Price;
}
}
Answer by ShadyProductions · Feb 17, 2020 at 03:11 PM
I don't know why you deleted your previous question and then reposted the same one, but as I said before, you have to add the Serializable attribute to your Droid class.
[Serializable]
public class Droid
{
public string Name;
public float Durability;
public float Firerate;
public int Price;
}
ohh nice! I found out that [System.Serializable] works out for me. Sorry about the deleted post, I had a hard time trying get to the community post back then. sorry for the mixup and thanks in advance :)
Your answer
![](https://koobas.hobune.stream/wayback/20220612223510im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
C# Make array based on script variable 1 Answer
Perform Action Foreach Variable of a Specific INT in an Array C# 2 Answers
SVG asset variable 1 Answer
Make an array of scripts? 1 Answer
Multiple Cars not working 1 Answer