# How to keep a slider position?

**URL:** <https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937>\
**Category:** UI\
**Tags:** slider, unreal-engine, editor, UE4, Blueprint, question\
**Created:** [November 9, 2015, 3:17pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937 "2015-11-09T15:17:06Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pantlessnoodle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pantlessnoodle](https://forums.unrealengine.com/u/Pantlessnoodle)\
**Post date:** [November 9, 2015, 3:17pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/1 "2015-11-09T15:17:06Z")

</div>

Hey guys, basically im wonder how to keep the slider position when you leave and re-enter the menu. The sliders keep resetting back to 100%. Any help would be really appreciated! 🙂

 ![66135-ue4editor+2015-11-09+15-15-11-59.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/7/6/876c903cd9e9c6da7f72722a3df5fe4b03fa05fd.jpeg)

 ![66137-ue4editor+2015-11-09+15-16-43-91.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/0/c80df6a5107f6a22bae67709675ddd247e9b397f.jpeg)

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [November 9, 2015, 6:30pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/2 "2015-11-09T18:30:37Z")

</div>

Set/Get the slider’s variable in your game instance BP, and then set the variable in widget with EventConstruct so that it refreshes the slider every time it is shown on the screen.

---

<div class="post-metadata">

**Author:** ![Pantlessnoodle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pantlessnoodle](https://forums.unrealengine.com/u/Pantlessnoodle)\
**Post date:** [November 9, 2015, 7:02pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/3 "2015-11-09T19:02:58Z")

</div>

Any chance of a image with how to do that? This is my first time doing anything like this, Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [November 9, 2015, 7:32pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/4 "2015-11-09T19:32:52Z")

</div>

Create a variable in your game instance BP(it is a string in my case. You can make it a float if you like) and then call and set it in your widget BP like so:

 ![66172-slider1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/a/0/6a02986d8455cc8c87bab0d43cd8d35da6fc272e.jpeg)

Then in the widget BP again, call and get the variable to set the slider’s value:

 ![66173-slider2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/5/2/a529f693f1e0f82e9dbb7284fb99280bbe9c199f.jpeg)

Game instance will pass the variable between levels as long as the game is running. Of course, if you want to save the slider position and the value after you restart the game you need to create your own save system.

---

<div class="post-metadata">

**Author:** ![Pantlessnoodle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pantlessnoodle](https://forums.unrealengine.com/u/Pantlessnoodle)\
**Post date:** [November 10, 2015, 8:21pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/5 "2015-11-10T20:21:28Z")

</div>

Oh wicked thanks alot! How do you call the variable from the game instance BP to the Widget BP?

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [November 10, 2015, 8:35pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/6 "2015-11-10T20:35:27Z")

</div>

Drag from the blue pin of Cast to gameinstance node and type the name of your variable. You’ll see Get and Set nodes in the list.

---

<div class="post-metadata">

**Author:** ![Pantlessnoodle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pantlessnoodle](https://forums.unrealengine.com/u/Pantlessnoodle)\
**Post date:** [November 10, 2015, 8:57pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/7 "2015-11-10T20:57:15Z")

</div>

![66312-ue4editor+2015-11-10+20-55-27-04.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/2/7/5277054e2d272414e30ddb3961e91e6f13ba570d.jpeg)

I think i have it right? 🙂

---

<div class="post-metadata">

**Author:** ![Pantlessnoodle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pantlessnoodle](https://forums.unrealengine.com/u/Pantlessnoodle)\
**Post date:** [November 10, 2015, 10:10pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/8 "2015-11-10T22:10:55Z")

</div>

Ok good news i have it working (sort of) thanks to you! Really appreciate it! Its saving the percentage of what they were set to, but the marker on the slider is going back to the same position

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [November 10, 2015, 11:34pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/9 "2015-11-10T23:34:24Z")

</div>

Are you setting the slider’s variable with Event Construct? You need to do that so that it gets the saved value from game instance every time you open the widget.

---

<div class="post-metadata">

**Author:** ![Pantlessnoodle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pantlessnoodle](https://forums.unrealengine.com/u/Pantlessnoodle)\
**Post date:** [November 10, 2015, 11:49pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/10 "2015-11-10T23:49:53Z")

</div>

Yeah i am pretty sure i have it exactly like you do ☹

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [November 10, 2015, 11:55pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/11 "2015-11-10T23:55:55Z")

</div>

Hmm, there may be a problem with your mapping values then. Actually you dont need to use map Range if the value you want to set is 0 to 100; in which case you just need to divide it by 100 to get a value between 0 and 1 for the slider.

---

<div class="post-metadata">

**Author:** ![Pantlessnoodle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pantlessnoodle](https://forums.unrealengine.com/u/Pantlessnoodle)\
**Post date:** [November 11, 2015, 12:04am UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/12 "2015-11-11T00:04:03Z")

</div>

yeah i ended up removing them so the value was just 0.0-1.0, tried messing about but the marker on the slider just keeps resetting to 1.0, really odd because the values are basic enough

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [November 11, 2015, 12:22am UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/13 "2015-11-11T00:22:23Z")

</div>

Can you post a screenshot of that part please?

---

<div class="post-metadata">

**Author:** ![Pantlessnoodle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pantlessnoodle](https://forums.unrealengine.com/u/Pantlessnoodle)\
**Post date:** [November 11, 2015, 12:26am UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/14 "2015-11-11T00:26:49Z")

</div>

![66337-ue4editor+2015-11-11+00-26-48-42.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/d/8/cd8b6af251b951552c3c729ceb6eca4fb471b8db.jpeg)

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [November 11, 2015, 2:55pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/15 "2015-11-11T14:55:33Z")

</div>

I’m not sure what the problem is. It should work just fine as long as the float variable you are setting/getting in game instance is in 0 - 1 range. : \

---

<div class="post-metadata">

**Author:** ![Pantlessnoodle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pantlessnoodle](https://forums.unrealengine.com/u/Pantlessnoodle)\
**Post date:** [November 11, 2015, 7:21pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/16 "2015-11-11T19:21:31Z")

</div>

Yeah i dont get it either 😕 , could adding, on mouse capture end have anything to do with the final position of the marker after you let go of it? Or maybe some boxes on the variables need to be ticked?

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [November 11, 2015, 11:30pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/17 "2015-11-11T23:30:19Z")

</div>

No, just OnValueChanged should be enough. You need to go through those variables again and make sure everything is set in order i guess.

Btw, you dont need to get game instance \> Cast to separately every time you call those slider variables. Get game instance \> Cast to yourgameinstance \> get slider position 1,2 and 3 from the same cast.

---

<div class="post-metadata">

**Author:** ![Pantlessnoodle](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pantlessnoodle](https://forums.unrealengine.com/u/Pantlessnoodle)\
**Post date:** [December 26, 2015, 3:32pm UTC](https://forums.unrealengine.com/t/how-to-keep-a-slider-position/337937/18 "2015-12-26T15:32:11Z")

</div>

Just to give you an update and anyone whos looking at this for answers. I got it working. I didnt bind the actual slider to the variable! that is all i missed out! Once again thanks alot!
