# Is it a good practice to have method variations just for event-registering situations?

**URL:** <https://forums.unrealengine.com/t/is-it-a-good-practice-to-have-method-variations-just-for-event-registering-situations/1770211>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [March 24, 2024, 6:00pm UTC](https://forums.unrealengine.com/t/is-it-a-good-practice-to-have-method-variations-just-for-event-registering-situations/1770211 "2024-03-24T18:00:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shoka](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shoka/32/1169404_2.png) [@Shoka](https://forums.unrealengine.com/u/Shoka)\
**Post date:** [March 24, 2024, 6:00pm UTC](https://forums.unrealengine.com/t/is-it-a-good-practice-to-have-method-variations-just-for-event-registering-situations/1770211/1 "2024-03-24T18:00:49Z")

</div>

While trying to register a method to an AreaCaptureDevice, I had to place a parameter in the method, in order to be able to register it:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/3/3/e3332de2a5d9cb68da1ea440f2b8d7ad9edae567.png)

And now I also want to call this function inside OnBegin() and other places, but I need to pass this Agent parameter, and I don’t really have (or need it) in the context of that code.

How should I proceed in this kind of situation? Should I make 2methods, one just for registering and one for generic situations? Or is there an easy way to get this agent as parameter, even trough I don’t have or need it at that moment?

---

<div class="post-metadata">

**Author:** ![bananna\_manuk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bananna\_manuk](https://forums.unrealengine.com/u/bananna_manuk)\
**Post date:** [March 24, 2024, 10:47pm UTC](https://forums.unrealengine.com/t/is-it-a-good-practice-to-have-method-variations-just-for-event-registering-situations/1770211/2 "2024-03-24T22:47:10Z")

</div>

if im understanding you properly the agent is passed from the event you Subscribed to.

you dont have to use it it but it is a requirement for you to be able to use the subscribe as far as im aware

---

<div class="post-metadata">

**Author:** ![t.tutiya](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/t.tutiya/32/924637_2.png) [@t.tutiya](https://forums.unrealengine.com/u/t.tutiya)\
**Post date:** [March 25, 2024, 2:10am UTC](https://forums.unrealengine.com/t/is-it-a-good-practice-to-have-method-variations-just-for-event-registering-situations/1770211/3 "2024-03-25T02:10:45Z")

</div>

I hope you find this article helpful.

> [@Where can I get the ‘agent’ to be used here?(switch\_device ver.)](https://forums.unrealengine.com/t/where-can-i-get-the-agent-to-be-used-here-switch-device-ver/1277212):
>
> If I want to toggle SwitchA when 10 seconds have elapsed from the start of the game, what should I specify as the Agent? In this case, there is no instigator to toggle the switch The following code seems redundant(Sorry, Not tested.). TeamCollection := GetPlayspace().GetTeamCollection() if: Teams := TeamCollection.GetTeams() Agents := TeamCollection.GetAgents[Teams[0]] Agent := Agents[0] then: SwitchA.ToggleState(Agent) #SwitchA : switch\_device Thank you.

```auto
if:
    Agent := GetPlayspace().GetPlayers()[0]
then:
    SwitchDevice.ToggleState(Agent)

```
