# Verse API GetCurrentState\[Agent\] of Switch Device is broken

**URL:** <https://forums.unrealengine.com/t/verse-api-getcurrentstate-agent-of-switch-device-is-broken/2108040>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, bug-report, editor, fortnite\
**Created:** [November 6, 2024, 3:09pm UTC](https://forums.unrealengine.com/t/verse-api-getcurrentstate-agent-of-switch-device-is-broken/2108040 "2024-11-06T15:09:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Novusa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Novusa](https://forums.unrealengine.com/u/Novusa)\
**Post date:** [November 6, 2024, 3:09pm UTC](https://forums.unrealengine.com/t/verse-api-getcurrentstate-agent-of-switch-device-is-broken/2108040/1 "2024-11-06T15:09:16Z")

</div>

When using this API (GetCurrentState[Agent]) in a IF statement like “GetCurrentState[Agent] = false”  
it only works when the Switch is on “ON”. “GetCurrentState[Agent] = true” doesn’t even work.

---

<div class="post-metadata">

**Author:** ![swaggod](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/swaggod/32/1051181_2.png) [@swaggod](https://forums.unrealengine.com/u/swaggod)\
**Post date:** [November 6, 2024, 7:43pm UTC](https://forums.unrealengine.com/t/verse-api-getcurrentstate-agent-of-switch-device-is-broken/2108040/2 "2024-11-06T19:43:07Z")

</div>

If you share your code that isn’t working I can see what the problem might be

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [November 6, 2024, 8:19pm UTC](https://forums.unrealengine.com/t/verse-api-getcurrentstate-agent-of-switch-device-is-broken/2108040/3 "2024-11-06T20:19:00Z")

</div>

try this

```auto
if(Switch.GetCurrentState[Agent]):
      Print("Is True")
if(not Switch.GetCurrentState[Agent]):
      Print("Is False")

```

---

<div class="post-metadata">

**Author:** ![Novusa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Novusa](https://forums.unrealengine.com/u/Novusa)\
**Post date:** [November 8, 2024, 4:06pm UTC](https://forums.unrealengine.com/t/verse-api-getcurrentstate-agent-of-switch-device-is-broken/2108040/4 "2024-11-08T16:06:47Z")

</div>

Wait I will send u the code, sry for the late response, didnt see it. Thanks for your response

```auto
Check(Agent:agent):void=
        if:
            Switch1.GetCurrentState[Agent] = false
        then:
            Print("False")

        else if:
            Switch1.GetCurrentState[Agent] = true
        then:
            Print("True")

# False prints only when the Switch is on ON and True doesn't even worked out, before that I used just else instead as an fail.

```

---

<div class="post-metadata">

**Author:** ![Novusa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Novusa](https://forums.unrealengine.com/u/Novusa)\
**Post date:** [November 8, 2024, 4:07pm UTC](https://forums.unrealengine.com/t/verse-api-getcurrentstate-agent-of-switch-device-is-broken/2108040/5 "2024-11-08T16:07:50Z")

</div>

Okey I will try that now, thanks for your response

---

<div class="post-metadata">

**Author:** ![Novusa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Novusa](https://forums.unrealengine.com/u/Novusa)\
**Post date:** [November 8, 2024, 4:15pm UTC](https://forums.unrealengine.com/t/verse-api-getcurrentstate-agent-of-switch-device-is-broken/2108040/6 "2024-11-08T16:15:07Z")

</div>

Big thank you, worked out. I don’t understand why I couldn’t set it equal to a logic? Do you know why?

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [November 8, 2024, 5:28pm UTC](https://forums.unrealengine.com/t/verse-api-getcurrentstate-agent-of-switch-device-is-broken/2108040/7 "2024-11-08T17:28:08Z")

</div>

Because it does not return a bool but rather fails the function. Hope this solves your question

---

<div class="post-metadata">

**Author:** ![Novusa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Novusa](https://forums.unrealengine.com/u/Novusa)\
**Post date:** [November 8, 2024, 6:29pm UTC](https://forums.unrealengine.com/t/verse-api-getcurrentstate-agent-of-switch-device-is-broken/2108040/8 "2024-11-08T18:29:12Z")

</div>

Okey thanks, you helped a lot
