title: In unity3D, how to get the variable from other gameobject?
body: <p>I have successfully connected a bluetooth device to unity and trying to use the read in data to control other game object
  with this as reference
  <a href="http://answers.unity3d.com/questions/16484/how-to-import-neurosky-mindset-data-into-unity.html" rel="nofollow">http://answers.unity3d.com/questions/16484/how-to-import-neurosky-mindset-data-into-unity.html</a></p>
  
  <p>I attached the connection script to an empty game object and it can read in some variables.
  I set all variable to be public int and include the connection script to another game object script</p>
  
  <pre><code>public s_ReadNeuro readNeuroScript;
  </code></pre>
  
  <p>The problem is after that, I do not know how to get the public variable from the connection script  (for example, the attention and meditation values) which is read in constantly.
  How can I get them and use it in another game object script?Thank you</p>
  
  <p>Here is the connection script attached to an empty game object</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  
  public class s_ReadNeuro : MonoBehaviour {
  
  
  public int tgHandleId;
  public int tgConnectionStatus;
  public int tgPacketCount;
  public float attention;
  public float meditation;
  // Use this for initialization
  void Start () {
     setupNeuro();
  }
  
  // Update is called once per frame
  void Update () {
     readNeuro();
  }
  
  
  void setupNeuro() {
      tgHandleId = ThinkGear.TG_GetNewConnectionId();
  
      tgConnectionStatus = ThinkGear.TG_Connect(tgHandleId,
                                       "\\\\.\\COM4", 
                                       ThinkGear.BAUD_9600, 
                                       ThinkGear.STREAM_PACKETS);
  
  }
  
  
  void readNeuro() {
      tgPacketCount = ThinkGear.TG_ReadPackets(tgHandleId, -1);
  
      attention = ThinkGear.TG_GetValue(tgHandleId,  ThinkGear.DATA_ATTENTION);
  
      meditation = ThinkGear.TG_GetValue(tgHandleId, ThinkGear.DATA_MEDITATION);
  
  }}
  </code></pre>