Best practices/methods to list a variable number of levels/Blueprints?
Admittedly this is my first foray in to anything Unreal Engine related so it is entirely possible I have missed the functionality that meets my requirements. Or, perhaps there is a different way of achieving what I'm after?
I'm prototyping a music+puzzle game and want to see how far I can get without writing a single line of code.
I have a Blueprint, let's call it "Puzzle Stage", which defines some core functionality/behaviour and variables for Blueprints based on this.
Then each puzzle level is essentially a Blueprint based on that "Puzzle Stage" Blueprint. Each puzzle level has their own music files, camera components, artist/track details, timelines, etc.
Is there a way I can iterate all Blueprint classes derived from "Puzzle Stage" to get the artist/track strings, without actually instantiating that Blueprint Actor? (Presuming you can even treat blueprint variables as "static")
Until I can work out a decent method for this I'm manually creating menu items/etc for each puzzle level Blueprint.
I suppose if there is a way to dynamically list levels in the game package I could change the structure so that a level is a puzzle...
Ultimately, if I have to manually define all menu items then I'll have to do that, but it would be nice not to do that for every new puzzle/song that is added to the project.
asked May 06 '14 at 11:22 PM in Blueprint Scripting
Blueprints do support inheritance, and any blueprint derived from the base class does inherit all of the functionality from the parent class. It is also possible for child classes to override the default functionality. In order to create a child class, right click on the parent class in the content browser and select "Create Blueprint Using.."
As for iterating through the list, the answer is actually much easier than you might think. Create a Struct for your Soundtrack information with whatever variables you want. Then, in your Puzzle Stage base class, create an array variable. Create the structs for each song, either procedurally or manually, and add them to the array.
After that, you can iterate through the array and perform whatever functions you want. Alternatively, you could create a class specifically for your music and put the functionality there. One small note though. To my knowledge you will not be able to act upon something that does not exist in your level unless it is added to your game mode class. So, if you want to act upon something that does not exist in the scene, that would be a good place to do it.
Hope that helps Tony
answered Nov 10 '14 at 05:07 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here