Quantcast
Channel: Questions in topic: "class instance"
Viewing all articles
Browse latest Browse all 131

c# class array not showing up in inspector

$
0
0
This might seem like a stupid question, but I can't figure out why it doesn't work. I have a c# class not inheriting from MonoBehaviour and marked as serializable. Then I have another (normal MonoBehaviour) class which has a two-dimensional array of that first class. I tried everything but the two-dimensional class array won't show up in the Inspector. The code goes about as follows: //file name Master.cs using UnityEngine; using System.Collections; public class Master : MonoBehaviour { //header doesn't even show up, only if i put another variable after it [Header("Stuff")] someClass[,] xyz = new someClass[1,1]; //someClass[,] xyz; -> didn't work either [Header("Other Stuff")] public int otherVar = 0; //both work public bool bar = false; } [System.Serializable] public class someClass { public int var1 = 23; public string var2 = "foo"; } I tried everything and looked for solutions, but nothing helped. All the code in the main class works and I'm sure all the someClass handling works (I get no errors), but I need the class array to show up.

Viewing all articles
Browse latest Browse all 131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>