# Set slider values without triggering \`OnValueChanged()\`

**URL:** <https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179>\
**Category:** Programming & Scripting\
**Tags:** slider, unreal-engine, Event, Widget\
**Created:** [October 12, 2024, 4:15pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179 "2024-10-12T16:15:27Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![IronAttorney](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IronAttorney](https://forums.unrealengine.com/u/IronAttorney)\
**Post date:** [October 12, 2024, 4:15pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/1 "2024-10-12T16:15:27Z")

</div>

I have 5 sliders that all change value when 1 does. I’m doing a full round trip to the server and back to calculate the new values when 1 slider changes, and then the PlayerController on the original calling client will call a method on the parent widget that in turn calls `SetValue()` on the 4 sliders that didn’t cause the change.

Unfortunately, I can’t find a way to set the slider values without triggering the `OnValueChanged()` event for the 4 I’m setting, which triggers an infinite feedback look.

I would have thought there should either be a function called something like `SetValueWithoutEvent()`, or have a boolean on the `SetValue()` method to state without the event should be triggered. Is there nothing like this? Or is there something else obvious I’m missing?

I have read other pitched solutions, and none of them are viable.

One solution was to set a member var boolean to state whether the event should be called, and then reference and clear that inside the `OnValueChanged()` event… but not only is that an incredibly ugle solution, it’s also potenitally going to lead to race condition like complications. This idea goes completely against what I know about writing code.

Another was to unbind and rebind the `OnValueChanged()` event, but I can’t reference that within the function that’s calling `SetValue()`, that can only be referenced directly inside the event graph. It also seems like an odd solution presumably with some minor overhead compared to just having a boolean or seperate event that avoids triggering the event…

---

<div class="post-metadata">

**Author:** ![AlienRenders](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienRenders](https://forums.unrealengine.com/u/AlienRenders)\
**Post date:** [October 12, 2024, 11:50pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/2 "2024-10-12T23:50:32Z")

</div>

1. In the Editor menu, click on Tools/New C++ Class
2. Click “All Classes”
3. Type “Slider” in the search box.
4. Scroll down to the row that says exactly “Slider” and select it.
5. Click “Next”
6. Give your new Slider a name.
7. Click “Create Class”

Add this method so that your header looks something like this. MYGAME\_API and your class name will be different as well as the last include.

```auto
#pragma once

#include "CoreMinimal.h"
#include "Components/Slider.h"
#include "MySlider.generated.h"

UCLASS()
class MYGAME_API UMySlider : public USlider
{
	GENERATED_BODY()
public:

  UFUNCTION(BlueprintCallable)
	void SetValueWithoutEvent(float InValue);
	
};

```

For your .cpp file, it should look like this. The first include will be your own class header. The second include needs to be added. Change UMySlider for your own class name.

```auto
#include "MySlider.h"
#include "Widgets/Input/SSlider.h"

void UMySlider::SetValueWithoutEvent(float InValue)
{
  if (MySlider.IsValid())
  {
    MySlider->SetValue(InValue);
  }

  if (Value != InValue)
  {
    Value = InValue;
  }
}

```

Compile this. Even live compile should work. It should now show up in your palette.

---

<div class="post-metadata">

**Author:** ![IronAttorney](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IronAttorney](https://forums.unrealengine.com/u/IronAttorney)\
**Post date:** [October 15, 2024, 12:32pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/4 "2024-10-15T12:32:39Z")

</div>

Ok… so I’m gathering from looking at UE’s slider code that `MySlider` is the GUI component is it?

Trying to call `MySlider->SetValue()` causes a linker error. `MySlider.IsValid()` is fine, but `SetValue()` is playing up.

```auto
> Slider2.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void__cdecl SSlider::SetValue(class TAttribute<float>)" (__imp_?SetValue@SSlider@@QEAAXV?$TAttribute@M@@@Z) referenced in function "public: void__cdecl USlider2::set_value(float,bool)" (?set_value@USlider2@@QEAAXM_N@Z)

> Hint on symbols that are defined and could potentially match:

> "__declspec(dllimport) public: void__cdecl USlider::SetValue(float)" (__imp_?SetValue@USlider@@QEAAXM@Z)

> D:\PeterBurcello\Documents\Unreal Projects\RTSMapGenerator\Binaries\Win64\UnrealEditor-RTSMapGenerator.dll : fatal error LNK1120: 1 unresolved externals

```

It’s hint ofcourse being the original `SetValue()` I’m trying to avoid

---

<div class="post-metadata">

**Author:** ![IronAttorney](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IronAttorney](https://forums.unrealengine.com/u/IronAttorney)\
**Post date:** [October 15, 2024, 1:07pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/5 "2024-10-15T13:07:05Z")

</div>

If I remove what I suspect is the GUI update line that’s causing the linker error, I don’t see the slider GUI update, and I’m being warned not to use `Value = x` directly…

```auto
warning C4996: 'USlider::Value': Direct access to Value is deprecated. Please use the getter or setter. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.

```

My implementation:

```c++
#pragma once

#include "CoreMinimal.h"
#include "Components/Slider.h"
#include "Slider2.generated.h"

/**
 * 
 */
UCLASS()
class RTSMAPGENERATOR_API USlider2 : public USlider
{
	GENERATED_BODY()

	UFUNCTION(BlueprintCallable)
	void set_value(float in_value, bool trigger_event);
};

```

```c++
#include "Slider2.h"

void USlider2::set_value(float in_value, bool trigger_event)
{
    if (trigger_event) {
        USlider::SetValue(in_value);
        return;
    }

    if (Value != in_value)
        Value = in_value;
}

```

And all the same, this is a messy way to solve this problem too. Surely there’s a straight forward way directly in blueprints I can set the value without triggering the event and not have to create a whole new C++ class just to do this?

---

<div class="post-metadata">

**Author:** ![IronAttorney](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IronAttorney](https://forums.unrealengine.com/u/IronAttorney)\
**Post date:** [October 15, 2024, 1:33pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/6 "2024-10-15T13:33:03Z")

</div>

To fix the linker error, I had to update my `[ProjectName].Build.cs` file to include Slate modules.

```cs
using UnrealBuildTool;

public class RTSMapGenerator : ModuleRules
{
	public RTSMapGenerator(ReadOnlyTargetRules Target) : base(Target)
	{
		PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
	
		PublicDependencyModuleNames.AddRange(new string[] 
		{
			"Core",
			"CoreUObject", 
			"Engine", 
			"InputCore",
		});

		PrivateDependencyModuleNames.AddRange(new string[] 
		{
            "Slate",
            "SlateCore",
        });
		
		// Uncomment if you are using online features
		// PrivateDependencyModuleNames.Add("OnlineSubsystem");

		// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true
	}
}

```

And the final class looks like so:

```c++
#pragma once

#include "CoreMinimal.h"
#include "Components/Slider.h"
#include "Slider2.generated.h"

/**
 * 
 */
UCLASS()
class RTSMAPGENERATOR_API USlider2 : public USlider
{
	GENERATED_BODY()

public:

	UFUNCTION(BlueprintCallable)
	void set_value(float in_value, bool trigger_event = true);
};

```

```c++
#include "Slider2.h"

#include "Widgets/Input/SSlider.h"

void USlider2::set_value(float in_value, bool trigger_event)
{
    if (trigger_event)
    {
        USlider::SetValue(in_value);
        return;
    }

    if (MySlider.IsValid())
        MySlider->SetValue(TAttribute<float>(in_value));

    if (Value != in_value)
        Value = in_value;
}

```

I still get the depreciated warnings, so fungers crossed this doesn’t break on next UE update.

---

<div class="post-metadata">

**Author:** ![AlienRenders](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienRenders](https://forums.unrealengine.com/u/AlienRenders)\
**Post date:** [October 15, 2024, 3:18pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/7 "2024-10-15T15:18:38Z")

</div>

I tested the code I gave you before posting. It linked perfectly fine. I see that you figured out to add the modules to your build.cs file. And yes, you will get a warning because your method IS the setter method. You’re defining a new one. That’s why you’re getting the warning.

Hopefully, if it does change in an update, they’ll just move the value to be protected. I can’t see them moving it private when MySlider is protected.

---

<div class="post-metadata">

**Author:** ![IronAttorney](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@IronAttorney](https://forums.unrealengine.com/u/IronAttorney)\
**Post date:** [October 15, 2024, 4:05pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/8 "2024-10-15T16:05:54Z")

</div>

So is the reality here that this can’t be done in blueprints with the current default Slider widget?

---

<div class="post-metadata">

**Author:** ![AlienRenders](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AlienRenders](https://forums.unrealengine.com/u/AlienRenders)\
**Post date:** [October 15, 2024, 4:27pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/9 "2024-10-15T16:27:21Z")

</div>

You asked for a specific method, so I showed one way to do that. As for your question if there are alternatives? Sure.

If you want to use the original widget directly with the new method, it’s possible. But only if you put your new method directly in the original Slider widget class and rebuild the engine. You’d have a custom build though, but it would work. You’d have to copy it every time you update the engine and you’d be forced to build from source.

As to a solution in blueprint only using the original widget? Dunno. I can’t think of anything. Setting the value is easy. But you need access to MySlider and that’s protected. It’s not even a property. So that’s a no go.

You can always create a custom widget though. Drop a slider in it and pass through whatever you need and duplicate the properties you use. Then you can create your own dispatchers and you can control exactly when they are called. It’s basically just creating a new widget. It’s not the original. But it is viable and gives you the control you need. And it’s BP only. I have no idea what your requirements are, so you’ll have to decide if this is usable or not.

The only other alternative aside from that you said you couldn’t do. I didn’t quite understand the explanation. Unbinding and rebinding OnValueChanged is a valid alternative implementation to your new method in C++ though. I think I like what you have now better though. I don’t like messing with delegates if I don’t have to. But if they do change “Value” to be private, you can use this implementation to keep it working.

---

<div class="post-metadata">

**Author:** ![Ategig](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ategig/32/1037376_2.png) [@Ategig](https://forums.unrealengine.com/u/Ategig)\
**Post date:** [March 17, 2025, 10:26am UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/10 "2025-03-17T10:26:40Z")

</div>

For anyone is interested in a simple solution in blueprint only.

Make a new widget that contains the slider you want (this is a good step for consistent visuals across your project anyway).

In that new widget make a function similar to “Update Display Only”. Set a bool “is Updating Display Only” to true as a first step, set the value of the slider then set the bool to false.

This will give you the chance to ignore this visual update on the default On Value Changed event. You can call an event dispatcher for access to your new slider widget the same way the default one is set.

 ![Blueprint Help](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/8/6/e865ddbd48a760d19dad7ff0436696761c88c29b.jpeg)

---

<div class="post-metadata">

**Author:** ![thundercataj](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@thundercataj](https://forums.unrealengine.com/u/thundercataj)\
**Post date:** [April 8, 2025, 8:13am UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/11 "2025-04-08T08:13:30Z")

</div>

> [@Ategig](#):
>
> Update Display Only

Where are you calling the Update Display Only, and getting its input value from?

thanks!

---

<div class="post-metadata">

**Author:** ![Ategig](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ategig/32/1037376_2.png) [@Ategig](https://forums.unrealengine.com/u/Ategig)\
**Post date:** [April 11, 2025, 12:38am UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/12 "2025-04-11T00:38:38Z")

</div>

That’s a new function that I defined in order to solve this issue. This all exists in a custom widget I created.

The input value is just a float in the Input sections of that new function.

Let me know if that’s enough info to go off.

---

<div class="post-metadata">

**Author:** ![Razivoid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Razivoid](https://forums.unrealengine.com/u/Razivoid)\
**Post date:** [June 5, 2025, 6:32pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/13 "2025-06-05T18:32:33Z")

</div>

A simple solution is to use the other slider events which captures the click…  
`On Mouse Capture Begin`  
`On Mouse Capture End`

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/8/1/c812446cde06fee519273c19e598d5ffacd1cf74.png)

Then a conditional check:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/0/a/70ac602da43a8bf25ef3a59336f6edb589c237d6.png)

Note this would get a bit dirty if a Game Controller can also capture. You will want to also utilise those events if required and use an additional `bIsSliderCapturedByController` (conditional check should use OR). You may get bugs if a keyboard and controller is invoked at the same time so not a robust solution.

Another alternative is to duplicate the slider, ensuring the same style geometry for interaction. The containing Widget should be an Overlay. The first slider will act as the control (invisible thumb image), the second slider as the thumb graphic (set Visibility to `Not Hit-Testable`).

---

<div class="post-metadata">

**Author:** ![thundercataj](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@thundercataj](https://forums.unrealengine.com/u/thundercataj)\
**Post date:** [July 9, 2025, 12:19pm UTC](https://forums.unrealengine.com/t/set-slider-values-without-triggering-onvaluechanged/2065179/14 "2025-07-09T12:19:28Z")

</div>

Thanks for the reply [@Razivoid](https://dev.epicgames.com/community/api/user_profiles/tab-redirect/about?discourse_username=Razivoid)!

I was just coming back here to update the post, as I finally solved it.

Now I see your answer thanks! It was correct in the area to look at. I had found this out today 🙂 and added this (pic).

What you’re saying is about using the bool var. Which would also help fix it. Thanks for taking the time to reply, I appreciate it.

I added this:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/a/8/0a82216269842d6877c58af299866df1994c9339.png)
