- Home /
Change value from other object
Hi. I have two arrays of Instantiate objects. One is for stations, and other is for connecctions. First I spawn the stations, and later I want to connect stations. What I do is instantiate an object between two stations, the connection have two variable (A,B) for know from and to where is the connections. The problem I have is trying to change the values of that variables. I get all the time the error CS1061 and I can't figured out.
void connectStations(){
for(int i = 0; i < stations.Length; i++){
GameObject pathWay = trailSample;
Vector3 otherStation = selectRandomStation();
Vector3 position = stations[i].transform.position - otherStation;
paths[i] = Instantiate(pathWay, stations[i].transform.position, Quaternion.identity) as GameObject;
paths[i].pointA = stations[i].transform.position;
paths[i].pointB = otherStation;
}
}
And this is the code for the connection
public Vector3 pointA { set; get;}
public Vector3 pointB { set; get;}
void Awake () {
pointA = Vector3.zero;
pointB = Vector3.zero;
}
void OnDrawGizmos(){
Gizmos.DrawLine (pointA, pointB);
}
Comment
Your answer
Follow this Question
Related Questions
Material vs. SharedMaterial - difference in SETTING? 1 Answer
Update Variables from script to script? 1 Answer
Using Buttons to set Setters not working? 1 Answer
Getters issue... 1 Answer
Getter & Setter version Difference 1 Answer