Hi!
Here’s how my code works:
public class myClass : MonoBehaviour{
public static int[] myMethod(){
List<int> aList = new List<int>();
// ...
// Filling the list
int[] anArray = aList.ToArray();
return anArray;
}
}
and :
public class myMainClass : MonoBehaviour{
void OnGUI() {
Event e = Event.current;
if (e.button == 0 && e.isMouse){
int[] myArray = myClass.myMethod();
}
}
}
Now, the problem is that I need to return the array from myClass to myMainClass “on-the-fly”, that is, even if the array is not completely filed, it already has to return its first values.
Thank you!
Note: I use a list at first (and eventually convert it to an array) because of its dynamic size property.