我们将UV操作放入函数内,该函数的内容来自我之前的文章
一、UE在Material中右键,新建Material Function。

增加输入

二、新建Material,命名为DemoUVRotationUseFunction

Offset为偏移值,Rotation为旋转速度,Scale为重复数,Pivot旋转中心的位置。
三、Unity版本,新建Sub Graph命名为TransformUV。

新建变量

编写内容,可以复制摇晃树叶的代码进入该sub graph。

修改Output名字和类型

替换变量
UVs变量后面增加一个默认UV的设置,如果没有uv传入则使用默认uv。

别忘了保存,最后的代码是这样的。

四、调用该Sub Graph
