# (Reflection) Setting FProperty -- how to call ex: BlueprintSetter if needed?

**URL:** <https://forums.unrealengine.com/t/reflection-setting-fproperty-how-to-call-ex-blueprintsetter-if-needed/1188157>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, question\
**Created:** [June 4, 2023, 2:48am UTC](https://forums.unrealengine.com/t/reflection-setting-fproperty-how-to-call-ex-blueprintsetter-if-needed/1188157 "2023-06-04T02:48:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScottMichaud](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ScottMichaud](https://forums.unrealengine.com/u/ScottMichaud)\
**Post date:** [June 4, 2023, 2:48am UTC](https://forums.unrealengine.com/t/reflection-setting-fproperty-how-to-call-ex-blueprintsetter-if-needed/1188157/1 "2023-06-04T02:48:02Z")

</div>

So we’re working on a Web Server ↔ Unreal communication mechanism (for a virtual production company – NOTE: we’re weird in that we use _packaged_ builds, _not the editor_, which we feed webcam/iPhone video through – it’s a hands-off subscription service).

We are able to do list/read/write properties, call UFunctions, etc.

One problem is that, when we set properties that should cause code to run, such as changing a component’s RelativeLocation or a CineCamera component’s CurrentFocalLength, we would not move the object or change its focal length. This makes sense, because SetRelativeLocation and SetCurrentFocalLength do a lot more than just set the field value, but we’re just writing to memory and calling it a day (if we target the property). Again, we could call the function, but stakeholders want to feel like they’re accessing the properties as if it was Sequencer.

Some properties have ex: SetCurrentFocalLength listed as a BlueprintSetter, and other properties are listed as Interp (for Sequencer – although I don’t think that’s relevant to running code on set). I’ve tried HasSetter()/CallSetter() on one of the FFloatProperties corresponding to a BlueprintSetter property (IIRC CurrentFocalLength) but it returned false, so I assume it’s something else.

_**Is there a way to see from runtime (not editor) reflection whether there’s a better thing to do (ex: redirect to a UFunction call) than just write to its memory if we’re asked to set a specific UProperty to a specific value?**_

---

<div class="post-metadata">

**Author:** ![ScottMichaud](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ScottMichaud](https://forums.unrealengine.com/u/ScottMichaud)\
**Post date:** [June 4, 2023, 4:07am UTC](https://forums.unrealengine.com/t/reflection-setting-fproperty-how-to-call-ex-blueprintsetter-if-needed/1188157/2 "2023-06-04T04:07:49Z")

</div>

So, even though I’ve been working on this problem for days and haven’t seen this yet, apparently Remote Control has a duck test to try to find setter functions given a property name and an owning class.

static UFunction\* FindSetterFunction(FProperty\* Property, UClass\* OwnerClass)

---

<div class="post-metadata">

**Author:** ![UnrealEverything](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnrealEverything](https://forums.unrealengine.com/u/UnrealEverything)\
**Post date:** [June 4, 2023, 6:51am UTC](https://forums.unrealengine.com/t/reflection-setting-fproperty-how-to-call-ex-blueprintsetter-if-needed/1188157/3 "2023-06-04T06:51:38Z")

</div>

Shouldn’t this happen automatically if calling `FProperty::SetValue_InContainer`?

```auto
	FORCEINLINE void SetValue_InContainer(void* OutContainer, const void* InValue) const
	{
		if (!HasSetter())
		{
			CopyCompleteValue(ContainerVoidPtrToValuePtrInternal(OutContainer, 0), InValue);
		}
		else
		{
			CallSetter(OutContainer, InValue);
		}
	}

```

`HasSetter` and `CallSetter` should be implemented by the `TPropertyWithSetterAndGetter` that’s created here: [https://github.com/EpicGames/UnrealEngine/blob/407acc04a93f09ecb42c07c98b74fd00cc967100/Engine/Source/Runtime/CoreUObject/Private/UObject/UObjectGlobals.cpp#L5533](https://github.com/EpicGames/UnrealEngine/blob/407acc04a93f09ecb42c07c98b74fd00cc967100/Engine/Source/Runtime/CoreUObject/Private/UObject/UObjectGlobals.cpp#L5533)

---

<div class="post-metadata">

**Author:** ![ScottMichaud](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ScottMichaud](https://forums.unrealengine.com/u/ScottMichaud)\
**Post date:** [June 7, 2023, 2:15am UTC](https://forums.unrealengine.com/t/reflection-setting-fproperty-how-to-call-ex-blueprintsetter-if-needed/1188157/4 "2023-06-07T02:15:26Z")

</div>

So… when I check HasSetter() it comes up false, but, yes, SetValue\_InContainer (instead of SetPropertyValue\_InContainer) seems to set the focal length. Not sure what’s up with that. Could be a bug in my test or something.

Current process is:

- Try Remote Control’s FindSetterFunction() (because RelativeLocation doesn’t seem to work with SetValue\_InContainer). If no UFunction\* is found, then:
- Try SetValue\_InContainer.

---

<div class="post-metadata">

**Author:** ![UnrealEverything](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@UnrealEverything](https://forums.unrealengine.com/u/UnrealEverything)\
**Post date:** [June 7, 2023, 5:56am UTC](https://forums.unrealengine.com/t/reflection-setting-fproperty-how-to-call-ex-blueprintsetter-if-needed/1188157/5 "2023-06-07T05:56:50Z")

</div>

> [@ScottMichaud](#):
>
> RelativeLocation

Is this a custom property or the `USceneComponent::RelativeLocation`? If the latter then `HasGetter` probably returns false since the property doesn’t have the `BlueprintSetter` specifier even if it’s private and there is a `SetRelativeLocation` function. For this case the FindSetterFunction is probably the way to go.

---

<div class="post-metadata">

**Author:** ![ScottMichaud](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ScottMichaud](https://forums.unrealengine.com/u/ScottMichaud)\
**Post date:** [June 7, 2023, 4:27pm UTC](https://forums.unrealengine.com/t/reflection-setting-fproperty-how-to-call-ex-blueprintsetter-if-needed/1188157/6 "2023-06-07T16:27:32Z")

</div>

HasSetter() was false for (the FProperty\* corresponding to) CurrentFocalLength on CineCameraComponent.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [July 7, 2023, 4:27pm UTC](https://forums.unrealengine.com/t/reflection-setting-fproperty-how-to-call-ex-blueprintsetter-if-needed/1188157/7 "2023-07-07T16:27:52Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
