Verse Library verse

01 Using The Audio Mixer Device In Verse

Toggles an audio mixer on or off when a player interacts with a connected button device.

extracted-snippets/documentation/en-us/uefn/audio-mixer-in-unreal-editor-for-fortnite/01-using-the-audio-mixer-device-in-verse.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/audio-mixer-in-unreal-editor-for-fortnite
# Local doc:  epic-docs/documentation/en-us/uefn/audio-mixer-in-unreal-editor-for-fortnite.md
# Section:    Using the Audio Mixer Device in Verse
# Copyright Epic Games, Inc. All Rights Reserved.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# A creative device that allows an audio mixer to be toggled on and off via a button device
on_off_audio_mixer_device := class(creative_device):
@editable
AudioMixerDevice:audio_mixer_device = audio_mixer_device{}
@editable
Button:button_device = button_device{}
var MixActive:logic = false
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
Button.InteractedWithEvent.Subscribe(OnButtonInteractedWith)
OnButtonInteractedWith(InPlayer:agent):void=
if(MixActive?):
AudioMixerDevice.DeactivateMix()
set MixActive = false
else:
AudioMixerDevice.ActivateMix()
set MixActive = true

Comments

    Sign in to vote, comment, or suggest an edit. Sign in