Skip to content

Learn about some fundamentals in Unity - Lifecycle events, Instantiate, and Destroy!

License

Notifications You must be signed in to change notification settings

QrJuicy/unity-csharp-basics-3

 
 

Repository files navigation

Unity Coding Basics Part 3 - Lifecycle Events, Instantiate, and Destroy

If you've been using Unity for a while, or are just getting started with Unity and decided it's time for you to start learning how to write code - this is the video series you need to start your programming journey!

In this tutorial repository (with associated video), aimed at absolute beginners who have very little to no coding experience whatsoever, you'll learn about some fundamentals in Unity - Lifecycle events, Instantiate, and Destroy.

By this point, you've probably already used some of these lifecycle events, but maybe didn't fully understand how they were called or when they were called. In this tutorial you'll learn the order of execution of the following events, and what type of code you should generally put in those events:

  • Awake
  • Start
  • OnEnable
  • FixedUpdate
  • Update

📝📝📝YOUR HOMEWORK!📝📝📝

Using the prefab we created and used today and at least 1 new script (maybe you need more, maybe not, you decide 😉) make it where when the user left clicks in the top 10% of the screen, a new instance of our Count Down Text prefab is spawned at that left click location. Make the Count Down Text prefab start falling towards the bottom of the screen.

The Count Down Text should be destroyed under 2 conditions:

  1. If the AutoDestroyText count down has reached 0.
  2. If the Count Down Text has gone off screen (fallen out of view).

Here's some key resources for you to gather input from the user:

Add a comment below with a video showing your code and the end result.

📚 Here are the resources I mentioned and/or brought up during the video 📚

Youtube Tutorial

Patreon Supporters

Have you been getting value out of these tutorials? Do you believe in LlamAcademy's mission of helping everyone make their game dev dream become a reality? Consider becoming a Patreon supporter and get your name added to this list, as well as other cool perks. Head over to https://patreon.com/llamacademy to show your support.

Phenomenal Supporter Tier

  • YOUR NAME HERE!

Tremendous Supporter Tier

  • YOUR NAME HERE!

Awesome Supporter Tier

  • Raphael
  • Andrew Bowen
  • Gerald Anderson
  • AudemKay
  • Paul Berry
  • Matt Parkin
  • YOUR NAME HERE!

Supporters

  • Bastian
  • Trey Briggs
  • YOUR NAME HERE!

Other Projects

Interested in other AI Topics in Unity, or other tutorials on Unity in general?

Requirements

  • Requires Unity 2020.3 LTS or higher.

About

Learn about some fundamentals in Unity - Lifecycle events, Instantiate, and Destroy!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • ShaderLab 83.6%
  • HLSL 14.5%
  • C# 1.9%