I have a script to reference one of several arrays and apply the values to a number of variables in a number of Game Objects. I need to know how to reference and change variables from other Game Objects.
using UnityEngine;
using System.Collections;
public class MathVariables : MonoBehaviour {
string[] Eq1 = {"3","x","2","8","3","x","6","","","","","","subtract","2","divide","3","","3x+2=8","3x=6","x=3"};
public GameObject LeftText;
public GameObject RightText;
public GameObject TopText;
public GameObject BottomText;
// Use this for initialization
void Start () {
newEquation();
}
// Update is called once per frame
void Update () {
}
void newEquation () {
LeftText.Ringvariable = Eq1[0];
RightText.Ringvariable = Eq1[1];
TopText.Ringvariable = Eq1[2];
BottomText.Ringvariable = Eq1[3];
}
}
Fantastic. THat worked. Thank you.
– anosmicAnimator