# How to call GameMode function from another Blueprint

**URL:** <https://forums.unrealengine.com/t/how-to-call-gamemode-function-from-another-blueprint/349003>\
**Category:** Blueprint\
**Tags:** not-working, breakpoint, game-mode, unreal-engine, function, Blueprint, question\
**Created:** [February 28, 2016, 9:49pm UTC](https://forums.unrealengine.com/t/how-to-call-gamemode-function-from-another-blueprint/349003 "2016-02-28T21:49:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_36b471fa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_36b471fa](https://forums.unrealengine.com/u/anonymous_user_36b471fa)\
**Post date:** [February 28, 2016, 9:49pm UTC](https://forums.unrealengine.com/t/how-to-call-gamemode-function-from-another-blueprint/349003/1 "2016-02-28T21:49:50Z")

</div>

Hello,

I’m trying to call a function “Hide World” that lives on my game mode blueprint from my main player character. This function handles hiding objects in the world. I call the function from the character via a button press. It’s all pretty simple. However, the function on the game mode isn’t being hit (no breakpoint is hit), but the call on the character blueprint does hit the “Hide World” function and moves along to the next execution pin, without actually hitting the breakpoint inside “Hide World”.

I have created a variable for the game mode, of which I only have the one default one that came with the sample SideScrollerCharacter Unreal project. I created a new variable in the character blueprint and gave it a variable type of Side Scroller Game Mode from it’s dropdown and flagged it as editable via the tips on some of the other similar links.

As you can see, it already knows the specific target, and even yelled at me when I tried to cast it. Do I need a target instance instead and perhaps this is just hitting some default blueprint and that’s why it’s not working? On my game mode function breakpoint I have no filters on the breakpoint, so it should trigger on any blueprint call.

Any tips are greatly appreciated. Thanks!

![80327-unreal_character.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/1/5/515b0c0051820ef85e81f18c4b08d02d68a48415.png)

 ![80328-unreal_gamemode.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/a/6/2a6454a18f64b8ccc7daef61aa6af422ddfb3fe1.png)

---

<div class="post-metadata">

**Author:** ![paradoc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@paradoc](https://forums.unrealengine.com/u/paradoc)\
**Post date:** [February 29, 2016, 6:16pm UTC](https://forums.unrealengine.com/t/how-to-call-gamemode-function-from-another-blueprint/349003/2 "2016-02-29T18:16:03Z")

</div>

did you initialize the variable? so for example, in your character’s blueprint, on begin play, did you call ‘get game mode’ and cast the returned value to ‘yourCustomGameMode’ and then set the variable ‘GameMode’ (by the way, this naming might confuse you down the line. you may want to rename it to something more specific) to your objected returned from the cast?

---

<div class="post-metadata">

**Author:** ![Sentura](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sentura](https://forums.unrealengine.com/u/Sentura)\
**Post date:** [March 1, 2016, 12:41am UTC](https://forums.unrealengine.com/t/how-to-call-gamemode-function-from-another-blueprint/349003/3 "2016-03-01T00:41:13Z")

</div>

You can use the “Get Game Mode” node to get the current instance of the game mode. That should fix the problem for you.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_36b471fa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_36b471fa](https://forums.unrealengine.com/u/anonymous_user_36b471fa)\
**Post date:** [March 6, 2016, 12:26am UTC](https://forums.unrealengine.com/t/how-to-call-gamemode-function-from-another-blueprint/349003/4 "2016-03-06T00:26:28Z")

</div>

Excellent advice from you both! This not being an actual programming language makes me forget obvious things like initializing my variables. 😛

---

<div class="post-metadata">

**Author:** ![Sentura](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sentura](https://forums.unrealengine.com/u/Sentura)\
**Post date:** [March 6, 2016, 10:59am UTC](https://forums.unrealengine.com/t/how-to-call-gamemode-function-from-another-blueprint/349003/5 "2016-03-06T10:59:45Z")

</div>

Glad I could help. Could you please mark the question as solved by the answer of choice? Thanks. =)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_36b471fa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_36b471fa](https://forums.unrealengine.com/u/anonymous_user_36b471fa)\
**Post date:** [March 6, 2016, 6:43pm UTC](https://forums.unrealengine.com/t/how-to-call-gamemode-function-from-another-blueprint/349003/6 "2016-03-06T18:43:48Z")

</div>

I tried and couldn’t find out what button it was. Thanks for following up, got it this time. 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_e3a97998](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_e3a97998](https://forums.unrealengine.com/u/anonymous_user_e3a97998)\
**Post date:** [November 10, 2020, 7:47am UTC](https://forums.unrealengine.com/t/how-to-call-gamemode-function-from-another-blueprint/349003/7 "2020-11-10T07:47:34Z")

</div>

Also to cast to the actually game mode class you’re using.
