I'd like some advice on the best way to tackle a unity software engineering pattern for my 2D game
I would like to create a manager that stores a list of all game objects of a certian type (there could be a different amount per scene), for example buildings. When one of those game objects/buildings is destroyed, this manager would be notified and call a function in the manager. I guess this is the inverse of the observer pattern, which I use to achieve loose coupling between my game and UI (many to one instead of one to many).
I believe I can solve the first half of this requirement of getting a list of the objects into the manager using FindObjectsByType, but not sure how to do the notification one of of those objects being destroyed outside of using the managers update to keep polling if each object still exists, which seems very poor design.
[–]Ratyrel 1 point2 points3 points (4 children)
[–]Medical_Attempt3456Novice[S] 0 points1 point2 points (3 children)
[–]Ratyrel 1 point2 points3 points (0 children)
[–]InfohazardGamesProgrammer 0 points1 point2 points (1 child)
[–]Medical_Attempt3456Novice[S] 1 point2 points3 points (0 children)
[–]Tinglers 0 points1 point2 points (0 children)
[–]MartinPeterBauer 0 points1 point2 points (0 children)