How to randomly generate lights inside buttons in vr based on the beats of the song

Hello so I am trying to learn how to create in unreal engine for VR on how to make the following

I have a wall with holes its filled with small buttons where each have lights in them blue and red and I want a help on how I can make the lights of blue and red show up randomly between those buttons based on the beats of the music also a scoring system where it can counts the score on each time the player actually hit that correct button of light when it shows up

Hey Destinyily

I did a quick search (you may have found the same) but none the less do these sources get you on the right track?

UE4 Forum

Answer Hub

Not exact what I need actually what I want is a way to make the blue and red buttons that is on my wall to pop up randomly similar to whackamole game I am doing some research but until now I couldn’t find any for VR that’s why I am asking if anyone have idea or a project similar that does that with scoring system that counts how many times you actually hit the buttons correctly

I figured if you are able to get a timeline events to line up with the music, then it would be easy to call the function to display the random lights.

Hopefully someone who has had experience in this can comment :slight_smile:

VR has nothing to do with the logic you are trying to implement. You need to figure out a system that reads the music and based off certain highpoints in the music or a certain rythm events would be called.

Then for the randomization of the buttons you simply get all the locations where the buttons can appear and create an array of locations. Then when the event is triggered you spawn one of the buttons based off a random locationvector that you have saved in the location array.

Alternatively you can just place the buttons in the level get all those buttons and place them in an array. Then call an activate function you create on the button blueprints when you want one to appear. Again you can just get a random int in range to get a random button from the array.

Additionally you’d need to create an array with Active buttons so you know which buttons are not active yet when you want to activate a new button that is not active yet.

Alright I’ll look on for that newest as I thought to turn it down a notch and say I’ll just make it as in for the music everytime you click play it will play random song from a playlist songs and for the buttons I have red and blue on the wall randomized locations on that wall holes which will pop out and in from them so I’ll have to look on what you said but also if your free could you like just 2 buttons and do a blueprint for the same thing you said and screenshot it because I might not get it correctly as you have more experience than I do in this

Sorry. I don’t have the time to do that, and the best way of learning is doing my friend. So give it your best shot and if you are stuck you can just post another question.

Just start simple, create a blueprint that holds a button mesh with an emissive material. Then add a custom event to “activate” the button. When that event is called, you can switch out the material on the mesh to another material with a different colored emissive, or you create a dynamic material instance and set a different color on the material by changing a color parameter in the material.

Then you can add another custom event which is the “deactivate” event. When this is called you change the emissive intensity (another parameter on the material you can set when you create it) to 0 so it is not emissive so players know it is not “active” or you switch out the material on the mesh to a different material that does not have an emissive value.

As a quick side-note, for future reference please take the time and add periods and comma’s in your questions and answers. Not having any punctuation in your question and answers makes it very hard to read.

Alright thanks and will do