Switching music based on area (collision box)

Hi everyone, I kind need some help or at least a second opinion on this blueprint. Basically what I want to know is: Do you think this is the best way to go about detecting a box overlap and assigning an index to change the music played in an array. (for example if int = 0 play music in array 0 etc). I have already occupied tick for switching between day and night themes so I was left with using “event play” and “set time” as a way to work like a tick function. Overall is this the best way to go about doing something like this or is there a better way? Thanks!

You mean like you just have a box somewhere and you want a music to play if the player is in the box? And a different music to play if the player is outside?

I believe you could just do things like that with begin overlap and end overlap events that come with the collision box. You could either make the box an actor or maybe use these events through the level blueprint.

Then you would only have to detect if the player started inside the box or not once when they start the game.

You basically described what I am trying to achieve with the first two sentences. So I am trying to avoid using level blueprint and instead use an actor blueprints (to make it easy to copy/paste in different levels). With that in mind I have made two box triggers in the persistent level and am simply just referencing them within my actor blueprint. I just wanted to know if this is the cleanest way to do so (connecting a branch to a branch to check if the character is in the box trigger)

You don’t have to use the level blueprint to access the begin overlap/end overlap if you don’t want to. You can do that inside an actor as well.

Try creating a new actor. Then add a box collision component to it in the components section. The box should allow begin and end overlap events that just come with it. You can click them easy in the box details panel or right click find them in the general node listing.

I’m not sure what does or doesn’t count as “cleanest,” but that is probably the most common way to use the box overlap. It would probably be less nodes and not use a timer.