- Home /
Transfer ArrayList data into another script
I have two script FloorPlan and FloorPosition. The FloorPlan is attached to a plane and the FloorPosition is attached to the main camera. My purpose is to get the ArrayList data from the FloorPlan and then transfer the data into the FloorPosition so that it can display the data in a GUI box. The problem is that I am not sure how I can get the data out and then display it on my FloorPosition GUI.
Answer by 0rr3n1 · Sep 16, 2013 at 07:19 AM
Make sure that in both your scripts, your classes are public and not static. Then use GameObject.GetComponent in your floor position code to get the array from your floor plan. Then, set the array from your floor plan code to a new array in your floor position code. This new array can then be used for whatever you like. For additional information, or if I was too unclear go to this documentation:
http://docs.unity3d.com/Documentation/ScriptReference/GameObject.GetComponent.html
Your answer
Follow this Question
Related Questions
ArrayLists? 1 Answer
Can i Regenerate Terrain by assign terrain Data On GUI 0 Answers
ArrayLists vs Generic Lists 1 Answer
UI button change variables in another script 1 Answer
How will display values like table? 1 Answer