# When character possesses object the object changes color

**URL:** <https://forums.unrealengine.com/t/when-character-possesses-object-the-object-changes-color/463606>\
**Category:** Rendering\
**Tags:** Class, possession, unreal-engine, color, Blueprint, question\
**Created:** [April 10, 2020, 10:15pm UTC](https://forums.unrealengine.com/t/when-character-possesses-object-the-object-changes-color/463606 "2020-04-10T22:15:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ripchan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ripchan](https://forums.unrealengine.com/u/ripchan)\
**Post date:** [April 10, 2020, 10:15pm UTC](https://forums.unrealengine.com/t/when-character-possesses-object-the-object-changes-color/463606/1 "2020-04-10T22:15:19Z")

</div>

hey guys,

So basically I have it set up to where my default character can possess an object and move around as that object but I want the possessed object to change colour once it is possessed. I have linked a picture to my code below.

> **[Gyazo](https://gyazo.com/a4a01c0574635822de4b179d7ab3b7d0)**
>
> Easily capture screenshots, GIFs, and replays that are ready to share. Download the free app for windows and mac.

---

<div class="post-metadata">

**Author:** ![FSapio](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fsapio/32/1194616_2.png) [@FSapio](https://forums.unrealengine.com/u/FSapio)\
**Post date:** [April 10, 2020, 10:31pm UTC](https://forums.unrealengine.com/t/when-character-possesses-object-the-object-changes-color/463606/2 "2020-04-10T22:31:04Z")

</div>

You will have first to create a Material with a parameter, even as simple as the following one:

 ![299462-step1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/d/8/dd88c1c2d1573538773152899a98379a3aeb4c19.png)

Then, in the Blueprint of your _possessable_ object (which in your case, as I can see from your code, it is a Pawn, and you use the player controller to posses that pawn), you need to create a **Dynamic Material Instance** , and assigned it to your mesh (I assume that Static Mesh is the mesh characterizing your pawn), better if you do this in the construction script, and hold a reference to the material (if you use the shortcut to promote the pin to a variable, remember that it is not a local variable). Also, don’t forget to select the material you have just created.

 ![299466-step2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/5/5/555113f5661c6898928bb975f1d18002204dd799.png)

Finally, at the end of your code, you can just get your dynamic material (from the pawn) and set a parameter, in this case it is a vector, and the name needs to be the same you gave it in the material (in this example “BaseColor”). As you can see, you have a pin in which you can select a color or assign one with your custom logic.

 ![299467-step3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/0/a/60a553e01dc205d79ad9220d274c1efbecf11d08.png)

Hope this helps. If you have other questions, let me know.

---

<div class="post-metadata">

**Author:** ![ripchan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ripchan](https://forums.unrealengine.com/u/ripchan)\
**Post date:** [April 10, 2020, 10:35pm UTC](https://forums.unrealengine.com/t/when-character-possesses-object-the-object-changes-color/463606/3 "2020-04-10T22:35:22Z")

</div>

Hey thank you so much for the fast response my character is a 2D sprite will this still work for my character?

---

<div class="post-metadata">

**Author:** ![FSapio](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fsapio/32/1194616_2.png) [@FSapio](https://forums.unrealengine.com/u/FSapio)\
**Post date:** [April 10, 2020, 10:38pm UTC](https://forums.unrealengine.com/t/when-character-possesses-object-the-object-changes-color/463606/4 "2020-04-10T22:38:10Z")

</div>

Assuming your sprite relies on a material, then yes. In this case, you can either have a color parameter which you can change, or if you prefer, you can have a whole texture as a parameter, and change that dynamically.

---

<div class="post-metadata">

**Author:** ![ripchan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ripchan](https://forums.unrealengine.com/u/ripchan)\
**Post date:** [April 10, 2020, 10:39pm UTC](https://forums.unrealengine.com/t/when-character-possesses-object-the-object-changes-color/463606/5 "2020-04-10T22:39:45Z")

</div>

[Screenshot - 4284b84f20b70b89a52edb51a8e50eb9 - Gyazo](https://gyazo.com/4284b84f20b70b89a52edb51a8e50eb9) My character is a flipbook sprite

---

<div class="post-metadata">

**Author:** ![ripchan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ripchan](https://forums.unrealengine.com/u/ripchan)\
**Post date:** [April 10, 2020, 10:41pm UTC](https://forums.unrealengine.com/t/when-character-possesses-object-the-object-changes-color/463606/6 "2020-04-10T22:41:26Z")

</div>

> **[Gyazo](https://gyazo.com/ed3b52088a34604879c9008da385cc2f)**
>
> Easily capture screenshots, GIFs, and replays that are ready to share. Download the free app for windows and mac.

---

<div class="post-metadata">

**Author:** ![ripchan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ripchan](https://forums.unrealengine.com/u/ripchan)\
**Post date:** [April 10, 2020, 10:42pm UTC](https://forums.unrealengine.com/t/when-character-possesses-object-the-object-changes-color/463606/7 "2020-04-10T22:42:31Z")

</div>

I just want to say thank you again though for the fast response and I will look into ur suggestion I really mean it man without people like yourself helping others it would be very hard to progress forward I only hope that in the future I can help others how you have helped me.

---

<div class="post-metadata">

**Author:** ![FSapio](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/fsapio/32/1194616_2.png) [@FSapio](https://forums.unrealengine.com/u/FSapio)\
**Post date:** [April 10, 2020, 10:51pm UTC](https://forums.unrealengine.com/t/when-character-possesses-object-the-object-changes-color/463606/8 "2020-04-10T22:51:13Z")

</div>

In this case, you can either use the _Set Sprite Color_ function on your “_Sprite_” component (which is a flipbook component)… Or if this is not your case, you can just use the _Set Flipbook_ function, and you can select another flipbook (which can contain anything you want, such as a variation of the sprite with a different color).

![299468-sprite.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/c/f/6cf1ed88e73eff66dc90623f95785f89525521d0.png)
