Say I have a map for a board game. The map is represented by a Class file. All maps have the same named member variables and data arrays, just the values are different. no code.
Some of these maps will only be enabled after an In App Purchase. Therefore there will be a ‘Buy’ button for each map that is available but hasn’t been purchased. After a map is bought, a ‘Use this Map’ button will appear.
As new maps become available I’d like to add them to the project, rebuild it, and then resubmit the game to the App Store as an update.
Instead of manually modifying the script to display a new Buy (and Use) button for each newly added map. I want to dynamically create those buttons.
So far Ive only been able to add maps by doing everything manually: e.g. make a class file for each new map then manually edit the script that displays the ‘Buy’ and ‘Use’ buttons.
What I’ve been trying to do in every possible combination (make each map a component of a 'Map Directory GameObject, or make a new GameObject for each map, etc.) I always run up against not being able to enumerate through all the maps with the various Find/Get GameObject/Component methods of Unity, I can’t do it because each map is a different class. Also the script needs to dynamically pull in the size, and other properties of the map that is to be used.
What I’d like to do is when I create a new map, I just want to drop it into my project as a new component, or a new GameObject, and the script will see it and automatically create the appropriate button.
I’m sure there must be standard ways and well known techniques to accomplish this? But I don’t know of them yet. Please point me in the right direction.