Question by 
               pumegaming · May 10, 2019 at 03:47 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
              
 
               
              Answer by pumegaming · May 11, 2019 at 09:05 AM
nvm i figured it out
by directly use script
 ActionClick.ActionName[order] = Order. ...;
 
              Your answer
 
             Follow this Question
Related Questions
Cant define array from other script 0 Answers
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