# Niagara - How to set texture sample user parameter in BP?

**URL:** <https://forums.unrealengine.com/t/niagara-how-to-set-texture-sample-user-parameter-in-bp/136035>\
**Category:** FX\
**Tags:** unreal-engine\
**Created:** [January 7, 2020, 12:55am UTC](https://forums.unrealengine.com/t/niagara-how-to-set-texture-sample-user-parameter-in-bp/136035 "2020-01-07T00:55:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![NormalNomad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NormalNomad](https://forums.unrealengine.com/u/NormalNomad)\
**Post date:** [January 7, 2020, 12:55am UTC](https://forums.unrealengine.com/t/niagara-how-to-set-texture-sample-user-parameter-in-bp/136035/1 "2020-01-07T00:55:08Z")

</div>

how do I set the user texture parameter for a texture sample? I tried using the set Niagara variable object, but that did not work.I created a Niagara emitter which is using a texture sample to generate particles using the color of the texture sample. the emitter works just fine when I set the texture sample in the Niagara editor. I would like to swap out the image at runtime although, so I created a user parameter and link it to the texture of the texture sample node. when I tried to set the value of the user parameter in a blueprint I don’t see an option for setting the Niagara variable texture sample. Instead I use the one for object, but it does not appear to work because the texture sample parameter Never Get Set correctly. Please let me know how I can accomplish this swapping of the image at runtime. Thank you in advance.

 ![issue.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/c/4/c4e49c622c9faa8ea44bdacd1eddafa66690d869.png)

---

<div class="post-metadata">

**Author:** ![RamiCreates](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RamiCreates](https://forums.unrealengine.com/u/RamiCreates)\
**Post date:** [December 31, 2020, 9:39pm UTC](https://forums.unrealengine.com/t/niagara-how-to-set-texture-sample-user-parameter-in-bp/136035/2 "2020-12-31T21:39:20Z")

</div>

Hey, it has almost been 5 months. Have you been able to find a solution?  
The following answer works for me in Editor, but it doesn’t work at all ina packaged build:  
[https://answers.unrealengine.com/questions/920988/how-do-you-set-a-texture-on-a-niagara-variable-at.html](https://answers.unrealengine.com/questions/920988/how-do-you-set-a-texture-on-a-niagara-variable-at.html)

---

<div class="post-metadata">

**Author:** ![NormalNomad](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NormalNomad](https://forums.unrealengine.com/u/NormalNomad)\
**Post date:** [January 12, 2021, 9:58pm UTC](https://forums.unrealengine.com/t/niagara-how-to-set-texture-sample-user-parameter-in-bp/136035/3 "2021-01-12T21:58:50Z")

</div>

I just saw your response. I never did find a solution for this. ☹

---

<div class="post-metadata">

**Author:** ![TobberHarley](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TobberHarley](https://forums.unrealengine.com/u/TobberHarley)\
**Post date:** [January 26, 2022, 3:59pm UTC](https://forums.unrealengine.com/t/niagara-how-to-set-texture-sample-user-parameter-in-bp/136035/4 "2022-01-26T15:59:57Z")

</div>

This seems to work for me. Haven’t tested extensively, but no issues so far.

I have a test scene that flips between two textures on the NiagaraSystem in Playmode and works fine.

```auto
void UMyBlueprintLibrary::SetNiagaraVariableTexture(UNiagaraComponent* NiagaraComponent, const FName OverrideName, UTexture* OverrideTexture)
{
	if (!NiagaraComponent || !OverrideTexture)
	{
		UE_LOG(LogTemp, Error, TEXT("NiagaraComponent or Override Texture is NULL!"))
		return;
	}

	UNiagaraDataInterface* DataInterface = UNiagaraFunctionLibrary::GetDataInterface(UNiagaraDataInterface::StaticClass(), NiagaraComponent, OverrideName);

	if (!DataInterface)
	{
		UE_LOG(LogTemp, Error, TEXT("Could not get DataInterface with OverrideName: %s"), *OverrideName.ToString())
		return;
	}

	if (const auto CurrentTextureSample = Cast<UNiagaraDataInterfaceTexture>(DataInterface))
	{
		CurrentTextureSample->SetTexture(OverrideTexture);
	}
	else
	{
		UE_LOG(LogTemp, Error, TEXT("Could not cast to DataInterfaceTexture!"))
	}
}

```

---

<div class="post-metadata">

**Author:** ![soreal](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@soreal](https://forums.unrealengine.com/u/soreal)\
**Post date:** [March 25, 2022, 2:53am UTC](https://forums.unrealengine.com/t/niagara-how-to-set-texture-sample-user-parameter-in-bp/136035/5 "2022-03-25T02:53:31Z")

</div>

I found a solution. First do the making a material interface like in this post and put that in the Material User Param under Sprite Rendering. Next create a dynamic material instance in BP and use that to set niagara material interface variable with a Set Niagara Variable (Material) node. When anything on this dynamic material instance is changed in the BP it will change on the particle system.

> **[Niagara User Param Binding](https://realtimevfx.com/t/niagara-user-param-binding/13421)**
>
> I’m trying to make Niagara randomly pick a material from the array on a mesh material override. In doing so I came to realize I don’t understand the “User Param Binding” at all. The UE4 documentation is not any help. What is the User Param Binding...

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3784804e](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3784804e](https://forums.unrealengine.com/u/anonymous_user_3784804e)\
**Post date:** [September 12, 2022, 3:10pm UTC](https://forums.unrealengine.com/t/niagara-how-to-set-texture-sample-user-parameter-in-bp/136035/6 "2022-09-12T15:10:39Z")

</div>

Try to use SetTextureObject node in blueprint.

---

<div class="post-metadata">

**Author:** ![RMF\_GG](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RMF\_GG](https://forums.unrealengine.com/u/RMF_GG)\
**Post date:** [February 23, 2024, 7:05pm UTC](https://forums.unrealengine.com/t/niagara-how-to-set-texture-sample-user-parameter-in-bp/136035/7 "2024-02-23T19:05:50Z")

</div>

I am trying to complete a instructional book and was struggling with this, but I think I have found the correct solution. The solution thread posted by soreal works, but doesn’t contain the full solution for me.

The issue:

If I use a “Set Texture Object” Node with a User Texture Sample Parameter, it changes textures properly in the Editor, but in PIE, the texture reverts back to whatever was set in the Niagara system.

Doesn’t work in PIE:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/b/9/db9126cf380ca64004d580a5dce44c48efde8ab7.png)

What worked for me was to create a “Texture” (Object) User Parameter and choose that instead as a “Texture User Parameter”:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/2/2/3223d3af4a9c982ab52633633a1f8636923bc50d.png)

Then in the Blueprint, I had the replace the “Set Texture Object” Node with the “Set Niagara Variable (Texture)” Node and add the name of the Texture object that I assigned to Texture User Parameter field:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/c/80c2fd4713bfb16ab4ab3ce0bb489c81e07198e5.jpeg)

Now it works in the Editor and in PIE. I’m pretty new to this, so I don’t understand exactly why, or what is the difference is between “Set Niagara Variable (Texture)” and “Set Texture Object”.

If a dev happens upon this, I think this would be a great opportunity for a little housekeeping, or at least some clearer documentation.
