# Creating a delay function in the material.

**URL:** <https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006>\
**Category:** Rendering\
**Tags:** delay, timer, unreal-engine, pause, question\
**Created:** [April 20, 2020, 10:52am UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006 "2020-04-20T10:52:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dragon\_Motion](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dragon\_Motion](https://forums.unrealengine.com/u/Dragon_Motion)\
**Post date:** [April 20, 2020, 10:52am UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/1 "2020-04-20T10:52:25Z")

</div>

Hi, everybody. I can’t figure out if this is possible in the material. Need a delay function. The material uses the node “Lerp” alpha must be equal to 1 every N seconds for N seconds. I can do this using Blueprints. But I am interested in the possibility of doing this in the material. Perhaps someone will tell you the code for a custom node or another implementation. In the screenshot, I showed more clearly what I need.Thanks.

 ![300147-2020-04-20-133547.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/3/e5340c54567048b2f2dbdf92146bac00703f28e1.jpeg)

---

<div class="post-metadata">

**Author:** ![Dragon\_Motion](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dragon\_Motion](https://forums.unrealengine.com/u/Dragon_Motion)\
**Post date:** [April 20, 2020, 1:08pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/2 "2020-04-20T13:08:08Z")

</div>

Thanks. But unfortunately it doesn’t fit. Standard Time Period, outputs a value from 0 to 1 every N seconds, this happens almost instantly. The goal is that every N seconds the value is equal to 1 for N seconds. It seems to me that it is possible to do this using a custom node and the necessary code, unfortunately I do not have enough experience to create it.

---

<div class="post-metadata">

**Author:** ![BamaGame](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BamaGame](https://forums.unrealengine.com/u/BamaGame)\
**Post date:** [April 20, 2020, 1:43pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/3 "2020-04-20T13:43:32Z")

</div>

maybe this is your answer

 ![300163-mat1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/6/6/5669ebca5c4cd51a548a6e0ea77bfae6941eedc3.png)

---

<div class="post-metadata">

**Author:** ![Dragon\_Motion](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dragon\_Motion](https://forums.unrealengine.com/u/Dragon_Motion)\
**Post date:** [April 20, 2020, 2:40pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/4 "2020-04-20T14:40:35Z")

</div>

Thank you for your response but this does not allow you to set a delay.  
This scheme switches colors every n value. But it does not allow you to set a delay for the blue color.

It is necessary that after switching the color after N time, the blue color was N time.

As an example. After 5 seconds, the color changes to blue, it remains blue for 2 seconds (the second N value) then the color changes to red and again after 5 seconds, it changes to blue for 2 seconds.

---

<div class="post-metadata">

**Author:** ![irajsb](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irajsb/32/740687_2.png) [@irajsb](https://forums.unrealengine.com/u/irajsb)\
**Post date:** [April 20, 2020, 2:57pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/5 "2020-04-20T14:57:16Z")

</div>

you can change speed to whatever u want like this

 ![300171-screenshot-27.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/9/3/2937884ca15005a290e4fd24981486f95557f315.jpeg)

Then use a if node to output 1 if A=1 and zero if A\<0. in this way you can get just 1 every N seconds.

---

<div class="post-metadata">

**Author:** ![irajsb](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irajsb/32/740687_2.png) [@irajsb](https://forums.unrealengine.com/u/irajsb)\
**Post date:** [April 20, 2020, 3:02pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/6 "2020-04-20T15:02:42Z")

</div>

![300172-screenshot-28.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/b/7/4b7c3c18e6c3659751f8569743d9340aa4453240.jpeg)

I made a full example

---

<div class="post-metadata">

**Author:** ![irajsb](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irajsb/32/740687_2.png) [@irajsb](https://forums.unrealengine.com/u/irajsb)\
**Post date:** [April 20, 2020, 3:38pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/7 "2020-04-20T15:38:39Z")

</div>

![300173-screenshot-29.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/2/7/827e564dbdd12eae05881de09e183f23737a0c9e.jpeg)

if u want to have ratio between time of 1 and 0 (like 5 secs “1” is passed and 2 sec “0” is passed you can move sin wave up using add node after sine node .

---

<div class="post-metadata">

**Author:** ![Dragon\_Motion](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dragon\_Motion](https://forums.unrealengine.com/u/Dragon_Motion)\
**Post date:** [April 20, 2020, 3:40pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/8 "2020-04-20T15:40:59Z")

</div>

Thanks for the detailed example, this almost solves the problem, but not completely. The problem in this example is that the second value is a coefficient from the first total time and will not allow you to set exact values. The best option is the one where you can set the time independently of each other in seconds.

---

<div class="post-metadata">

**Author:** ![Dragon\_Motion](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dragon\_Motion](https://forums.unrealengine.com/u/Dragon_Motion)\
**Post date:** [April 20, 2020, 4:23pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/9 "2020-04-20T16:23:11Z")

</div>

Thank you very much, your advice and example helped! I changed the scheme a little so that I could accurately set the time of the period and the delay in seconds.

 ![300175-2020-04-20-192052.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/9/7/a97d437d10e03b4843a0823f48d04fd57f48e413.jpeg)

---

<div class="post-metadata">

**Author:** ![BamaGame](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BamaGame](https://forums.unrealengine.com/u/BamaGame)\
**Post date:** [April 20, 2020, 8:13pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/10 "2020-04-20T20:13:06Z")

</div>

This is another for you N sec blue M sec Red

 ![300188-mat2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/9/1/8919abf9cb10f990525e63cc0bcc0add5acebfc8.png)

---

<div class="post-metadata">

**Author:** ![error406](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@error406](https://forums.unrealengine.com/u/error406)\
**Post date:** [September 11, 2021, 3:52pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/11 "2021-09-11T15:52:31Z")

</div>

thanks for posting the extra work you’ve done here - turned a 2 hour task into a 5 minute one, this works great

---

<div class="post-metadata">

**Author:** ![Greenman2306](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Greenman2306](https://forums.unrealengine.com/u/Greenman2306)\
**Post date:** [May 13, 2024, 6:57pm UTC](https://forums.unrealengine.com/t/creating-a-delay-function-in-the-material/464006/12 "2024-05-13T18:57:08Z")

</div>

This is genius
