how do i create a array eg imBank(11) of type mytype:
If any1 can spend time helping me it be really appreciated, and do variable inherit types from the system ive noticed playercontroller stuff inheriting .x .y ,z ,
Im new to unity really this Unity5 is the the future for sure UE who ??
how do i create a array eg imBank(11) of type mytype and mytype consists of (time(f),image(int),show(int)) type mytype time as float image as integer show as integer endtype
so use of array imBank(1).time =0.0; imBank(1).show =1; imBank(2).image = 2;
?? can be done right??
from old procedural languages thats how we used to do it,
How do i create a array eg imBank(11) of type mytype in c#
type mytype time as float; show as integer; image as integer; endtype
imBank[1].time = 0.0; imBank[1].show = 1; imBank[1].image = 1;
in procedural language this is how Im used to doing it, How is it done in unity??
Answer by hexagonius · Sep 25, 2015 at 10:39 AM
Create a struct or a class with those fields. create an array of that. If you want it to show up in the inspector, use [System.Serializable]
[System.Serializable]
public class imBank{
public int x;
public int y;
public float z;
}
public imBank[] banks;
...
imBank[0].x = 5;
Your answer
Follow this Question
Related Questions
Modify Custom Array Data 0 Answers
Why does this loop throw an error if int questComplete rises above 1? 0 Answers
Converting a string name to a sprite 2 Answers
Array problem, I'm novice 1 Answer