# Cannot cast from float2 to float3

**URL:** <https://forums.unrealengine.com/t/cannot-cast-from-float2-to-float3/483461>\
**Category:** Rendering\
**Tags:** float, errors, unreal-engine, functions, cast, question\
**Created:** [May 16, 2021, 3:07pm UTC](https://forums.unrealengine.com/t/cannot-cast-from-float2-to-float3/483461 "2021-05-16T15:07:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_bd3869761](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bd3869761](https://forums.unrealengine.com/u/anonymous_user_bd3869761)\
**Post date:** [May 16, 2021, 3:07pm UTC](https://forums.unrealengine.com/t/cannot-cast-from-float2-to-float3/483461/1 "2021-05-16T15:07:14Z")

</div>

I’m getting a warning about an function I have created.

 ![338993-function-dis.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/d/3fd00771e201501356bf45158287b4e84f95d798.png)

 ![338994-function-dis-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/c/6/1c6041d3cf27ffa046b5e833657715d74a92781d.png)

---

<div class="post-metadata">

**Author:** ![ManlyDrew](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ManlyDrew](https://forums.unrealengine.com/u/ManlyDrew)\
**Post date:** [May 16, 2021, 3:18pm UTC](https://forums.unrealengine.com/t/cannot-cast-from-float2-to-float3/483461/2 "2021-05-16T15:18:18Z")

</div>

In your “PBR\_Textures” material function your uv function input is of type float3. Your “Surface” material function probably outputs a float2 because uv’s have two channels (a “u” channel and a “v” channel). So to fix this you would just need to change your “Input UV’s (Vector3)” to a a vector2.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bd3869761](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bd3869761](https://forums.unrealengine.com/u/anonymous_user_bd3869761)\
**Post date:** [May 16, 2021, 7:02pm UTC](https://forums.unrealengine.com/t/cannot-cast-from-float2-to-float3/483461/3 "2021-05-16T19:02:44Z")

</div>

ManlyDrew, Thank you so much. Problem solved. I appreciate your help.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bd3869761](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bd3869761](https://forums.unrealengine.com/u/anonymous_user_bd3869761)\
**Post date:** [May 16, 2021, 7:03pm UTC](https://forums.unrealengine.com/t/cannot-cast-from-float2-to-float3/483461/4 "2021-05-16T19:03:00Z")

</div>

ManlyDrew, Thank you so much. Problem solved. I appreciate your help.

---

<div class="post-metadata">

**Author:** ![Baer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Baer](https://forums.unrealengine.com/u/Baer)\
**Post date:** [October 2, 2022, 6:44pm UTC](https://forums.unrealengine.com/t/cannot-cast-from-float2-to-float3/483461/5 "2022-10-02T18:44:23Z")

</div>

> change your “Input UV’s (Vector3)” to a vector2

How do you do this? I’ve searched for info on this but can’t find anything.

---

<div class="post-metadata">

**Author:** ![where44444](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@where44444](https://forums.unrealengine.com/u/where44444)\
**Post date:** [November 26, 2022, 6:28pm UTC](https://forums.unrealengine.com/t/cannot-cast-from-float2-to-float3/483461/6 "2022-11-26T18:28:18Z")

</div>

You click on the Function Input node, then on the details pane on the left of the screen, under “Input Type”, set it to “Function Input Vector 2”

---

<div class="post-metadata">

**Author:** ![Kimying](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kimying](https://forums.unrealengine.com/u/Kimying)\
**Post date:** [December 1, 2022, 1:21am UTC](https://forums.unrealengine.com/t/cannot-cast-from-float2-to-float3/483461/7 "2022-12-01T01:21:35Z")

</div>

Hi so sorry, I am facing the same problem here and I’ve read the entire thread, but…what Function Input node?

---

<div class="post-metadata">

**Author:** ![MisterPixel](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/misterpixel/32/629747_2.png) [@MisterPixel](https://forums.unrealengine.com/u/MisterPixel)\
**Post date:** [April 21, 2023, 11:46am UTC](https://forums.unrealengine.com/t/cannot-cast-from-float2-to-float3/483461/8 "2023-04-21T11:46:51Z")

</div>

@Kimying click on your Input note and on the left side panel, exactly under your preview window, you have the Details panel and under “Material Expression Function Input” you will find “Input Type” with a drop-down selection list. Here’s a screenshot:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/2/b/02b86d6151417c436071bdcfe96ecd7fb4aaeaf7.png)  
Hope this helps!
