# How to detect when Integer changes?

**URL:** <https://forums.unrealengine.com/t/how-to-detect-when-integer-changes/444077>\
**Category:** Blueprint\
**Tags:** Script, integer, unreal-engine, UE4, Blueprint, question\
**Created:** [February 24, 2019, 10:27pm UTC](https://forums.unrealengine.com/t/how-to-detect-when-integer-changes/444077 "2019-02-24T22:27:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cheesyball232](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cheesyball232](https://forums.unrealengine.com/u/cheesyball232)\
**Post date:** [February 24, 2019, 10:27pm UTC](https://forums.unrealengine.com/t/how-to-detect-when-integer-changes/444077/1 "2019-02-24T22:27:10Z")

</div>

I have an integer, used as the current day in the game. When it is a new day, I want to be able to call a custom event. The problem is that I cannot figure out how to call that event when the integer changes. How would I do this?

---

<div class="post-metadata">

**Author:** ![Crowley\_Caine](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Crowley\_Caine](https://forums.unrealengine.com/u/Crowley_Caine)\
**Post date:** [February 24, 2019, 10:50pm UTC](https://forums.unrealengine.com/t/how-to-detect-when-integer-changes/444077/2 "2019-02-24T22:50:44Z")

</div>

In the same event that updates the integer you would call the custom event.

If you need to detect a change as such that would be something that constantly checks if the value is the same, like event tick. I’d steer away from that.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3221808d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3221808d](https://forums.unrealengine.com/u/anonymous_user_3221808d)\
**Post date:** [February 24, 2019, 10:51pm UTC](https://forums.unrealengine.com/t/how-to-detect-when-integer-changes/444077/3 "2019-02-24T22:51:45Z")

</div>

If it’s a single player game your best bet is to change from setting the variable directly and instead creating a function that sets it.

Alternatively you could have a check on tick or timer for checking if it changed but that is much more expensive and requires duplicate variables.

If a always-multiplayer game you could use a Rep\_Notify variable to do as you want but this won’t work in standalone.

---

<div class="post-metadata">

**Author:** ![cheesyball232](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cheesyball232](https://forums.unrealengine.com/u/cheesyball232)\
**Post date:** [February 25, 2019, 12:15am UTC](https://forums.unrealengine.com/t/how-to-detect-when-integer-changes/444077/4 "2019-02-25T00:15:38Z")

</div>

Perfect, thanks!

---

<div class="post-metadata">

**Author:** ![cheesyball232](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@cheesyball232](https://forums.unrealengine.com/u/cheesyball232)\
**Post date:** [February 25, 2019, 12:15am UTC](https://forums.unrealengine.com/t/how-to-detect-when-integer-changes/444077/5 "2019-02-25T00:15:48Z")

</div>

Perfect, thanks!
