title: access an array in another script with variable name?
body: <p>Im very new in programming and i need help to solve a problem that arise.
  Im trying to access an array in another script and generally there is no problem. But my Situation ist this:</p>
  
  <p>For Example:</p>
  
  <p>Script A contains a few Arrays with different non numerical names.</p>
  
  <pre><code>   using UnityEngine;
     using System.Collections;
     using System.Collections.Generic;
  
     public class ScriptA : MonoBehaviour {
     public int[] keys = new int[4];
     public int[] screws= new int[4];
     public int[] nails= new int[4];
     public int[] iron= new int[4];
     ....
     }
  </code></pre>
  
  <p>Now in Script B i need to access these arrays but with an variable. How can i do this?</p>
  
  <p>For Example:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using System.Collections.Generic;
  
  public class ScriptB: MonoBehaviour {
      ScriptA scriptA;
      public string arrayName;    // Here user could type in the name of an array
  
  
  
      void Start()
      {
          scriptA = GameObject.Find("Object").GetComponent&lt;ScriptA&gt;();
  
          // This try to access the array of course not works. But how?
          scriptA.arrayname;   
      }
  </code></pre>
  
  <p>Thanks for ideas and solutions. I think its not a hard problem, but i have no idea to solve it. </p>