Quantcast
Channel: Questions in topic: "datatype"
Viewing all articles
Browse latest Browse all 87

Arrays with multiple data types C#

$
0
0
So I've heard this trick is pretty great at just handling data storage. And I wanna learn how to use it, but a few things I'm fuzzy on. I've read this answer, http://answers.unity3d.com/questions/698312/store-multiple-types-of-data-in-an-array.html but unfortunately I'm still learning C# and there are some things I'm fuzzy on. If I create a class; using UnityEngine; using System.Collections; using UnityEngine.UI; public class ButtonData : MonoBehaviour { public GameObject buttonGameObject; public Image buttonImage; public Button button; public float coolDown; public int value; } And then I call that class to create an array within another class; public ButtonData[] allButtonData; How come if I remove : MonoBehavior from the ButtonData class, the array of buttonData [] disappears in the inspector? And where do I fill in the values of each entry? It can't be done within the inspector as that only seems to be looking for objects containing that class? I guess I was sort of expecting a means to house data and then enter that data in the inspector like you can with any other single data type array. So if anyone knows of a great tutorial page or documentation as to how and coders use this method, I'd love to read it.

Viewing all articles
Browse latest Browse all 87

Trending Articles



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