How do I avoid creating hundreds of references in the level blueprint to the same type of object in the scene each with its own stats/states?
What you see below is a Go Board that is a blueprint, the white circles are sphere colliders called Go Points and they are another blueprint. I'll have another blueprint for the stones the player uses.
The problem I am having is that I need each Go Point to call a function in the level blueprint that will act as the game manager but how do I do that without creating 361 references in the level blueprint?
The game manager will control whose turn it is, valid & illegal moves, scoring, etc. I already know how to create a reference to the Go Points in the scene in the level blueprint, however I do not want to create 361 references to each Go Point. That would seem like sloppy design.
My question to the community is:
I'd prefer just one reference to all individual Go Points instead of hundreds. I thought of making all Go Points a single blueprint but I would need each Go Point to have its own state. If it's not possible to have a single blueprint with individual objects that have their own states I'll need another possible solution.
Dear reader, can you shine some light on this problem?
Thank you, Sfoxx28
asked Dec 23 '17 at 01:28 AM in Blueprint Scripting
If you manage it all correctly, that many references is fine. I'd have a 'board' actor. I'd reference it thru the game mode. I haven't worked much with level blueprints yet but I think the game will be more flexible if you use the game mode as the 'global' object. So the board actor has a list of all the squares. For the square actors, on BeginPlay, get the game mode, cast it, and save the board to a local reference. If you really need to save the memory then make a function that gets the game mode, casts it, and returns the board reference.
answered Dec 23 '17 at 01:51 AM
Hey there, you could create your own GameMode class for that, and it's always acessible by any actor (you just need to cast to your custom Game Mode class to be able to access to the custom functionality).
answered Dec 23 '17 at 01:47 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here