c# - How can I access a class that is inherited from monobehaviour -
My problem is a bit more complicated than the title: I've got a GUIController class, which controls the GUI and I want to To create an in-game buy menu, I can choose weapons in this menu and if I have got enough money then I can buy them. I have to use their data, prices, descriptions or names like this.
Problems:
To access your data, I must instantify an object from the class (data that must be run before accessing the start function).
- The main weapon class has been inherited from monobhabav, so I can not instantate any object from the class. Possible solutions:
- I can instantiate a gameback in which the class was included as a script component and then I could access its data. I think this is not a good solution.
Question: Should I submit information elsewhere? In a local DB or something? I thought it was a good idea to accumulate information inside the classroom, but I am not sure now.
Thank you for your reply in advance! Edit: Viewing your class hierarchy, the fixed variable suggestions will not work clearly. Edited to give another possible solution
You can create a new class for the The weapon properties can be made and transported in many ways. For a suggestion there will be a repository that can be used to reverse the context of the object (if they are single) or to withdraw a new one. By coincidence, this is a fairly comprehensive question and the 'right' answer can be that you have a lot of data and how you want to use it, or a case of best practice. As if it is possibly better or weapon properties and for each weapon type it can be an example. These codes can be populated with a database, config files, etc. When creating an example of a specific
weapon , you can give it an object of properties and copy the values of all the properties. This can be done using reflection to save writing assignments for each property.
Comments
Post a Comment