This question was
closed May 11, 2019 at 04:32 AM by
pumegaming.
Question by
pumegaming · May 10, 2019 at 03:46 PM ·
c#errorarrayother script
Cant define array from other script
Hello, I'm trying to define array in another script and i got this error: "IndexOutOfRangeException: Index was outside the bounds of the array. (wrapper stelemref) System.Object.virt_stelemref_sealed_class(intptr,object)"
my code:
int order = 0;
foreach (ActionList Order in ...)
{
Main.ActionName[order] = Order. ...;
order++;
}
Main script:
public string[] ActionName = new string[10];
However
When i define array in same script. i don't recive error:
string[] ActionName = new string[10];
int order = 0;
foreach (ActionList Order in ...)
{
ActionName[order] = Order. ...;
order++;
}
(... are non relate code to problem)
Comment
Follow this Question
Related Questions
Cant define array from other script 1 Answer
Get all Children of an Object with a certain component 0 Answers
IndexOutOfRangeException: Array index is out of range problem 2 Answers
How to get all children of a Gameobject with a certain component 2 Answers
Randomized array result from other scipt 2 Answers