- Home /
Question related to GetComponent
Global data structure accessible by any script?
Hello everybody, I'll try to explain my problem in the best way possible: in my game I have a script which reads an XML file and stores specific informations. I just have an empty game object which controls everything and through an instance of script reads the XML file. One of the read info might say: by accomplishing a general Action A I earn a certain amount of gold. Therefore, after I parse my XML I just store all the informations in a data structure (a list for example). Now, in my game I have a general Collider A which, when hit, wants to accede the list and find the information of the Action A.. how can I store this list in such a way that can be acceded from everywhere?
The easiest way to do this is to use the static modifier https://msdn.microsoft.com/en-us/library/98f28cdx.aspx.