How to Write Time Delays In Your Code! [Beginner Tutorial – Unity 2020]
How to execute code with a delay? In this tutorial we will take a look at how we can delay script or functions in Unity.
🧡 Subscribe to Oxmond Tutorials. Stay tuned!
https://bit.ly/SubscribeOxmondTutorials
✅ Free Assets from the Unity Assets Store:
https://assetstore.unity.com/lists/top-free-packages-13201?aid=1100l4p9k
😷👕 Need a face mask / developer T-shirt? Drop by our shop and get a 20% DISCOUNT on your first purchase by using the discount code OXMONDSALE. Click here:
https://shop.oxmond.com/discount/OXMONDSALE
Some links might be affiliate links. Any support is truly appreciated so we can keep on making high quality content
The Button script:
/* .-------. .--. .-------. .--. .--. .--. | |--.--.--------.-----.-----.--| | |_ _|--.--| |_.-----.----|__|---.-| |-----. | - |_ _| | _ | | _ | | | | | | _| _ | _| | _ | |__ --| |_______|__.__|__|__|__|_____|__|__|_____| |___| |_____|____|_____|__| |__|___._|__|_____| © 2018-2020 OXMOND / www.oxmond.com */ using System.Collections; using System.Collections.Generic; using UnityEngine; public class Button : MonoBehaviour { public GameObject textBtnIsClicked; public GameObject textDelayedAction; private void OnMouseUp() { textBtnIsClicked.SetActive(true); Invoke("Action", 2.0f); } private void Action() { textDelayedAction.SetActive(true); } }
Tags In
2019
2D
3D
Beginner Tutorial
Clock
delay
delay action
delay code
delay function call
delay update function
easy
execute code after delay
future
future execution
gameobject
how to
learn
lesson
method
object
Oxmond Unity Tutorials
run code after delay
scripting
sprite
time
timeline
timer
tip
Unity 2020
Unity delay 1 second
Unity delay code execution
Unity delay start function
Unity3d
video games
Related Posts
2 Comments
Leave a Reply Cancel reply
- Møde med Ms. Masako Wakamiya: Verdens ældste app-udvikler
- Red Cross & Oxmond Technology publishes an app for Ukrainian refugee families
- iTween Animation Examples
- How to Mask Graphics in Unity. 2D Sprite Mask Tutorial Unity 2020
- How to Write Time Delays In Your Code! [Beginner Tutorial – Unity 2020]
You have some really good posts. If you ever want to take some of the load off, I’d love to write some articles for your blog in exchange for a link back to mine. Please send me an e-mail if interested. Thanks!
I am really inspired together with your writing talents as smartly as with the structure on your weblog. Anyway stay up the excellent high quality writing, it is uncommon to see a great weblog like this one today..