How to add a delay in a C# unity script

I have these lines of code in an update function in a C# Unity script: I have tried Thread.Sleep(milliseconds) and Waitforseconds(). But I have had no luck in making them work. It would be greatly appreciated if anyone could show me a solution to this problem. Thanks, Isaac

Awake() and Start()

Usually Awake() is used to initialize if certain values or script are dependent on each other and would cause errors if one of them is initialized too late (awake runs before the game starts). Awake is also called only once for every script instance. Let me quote the Documentation: […] Awake is called after all objects are … Read more

How to Rename a Unity Project?

To change Unity project name: Change the unity project folder name (the parent folder of ‘Assets’ folder) Remove any file with .sln or .csproj suffixes under the project folder. (Unity will regenerate them) Does changing the project name change the game’s name (the name that appears on top left corner of the game window)? No! To change the … Read more

C# 2D platformer movement code

There are a couple of ways to achieve this but following your current implementation: why not set the isGrounded flag to false when you jump and just let the trigger handle resetting the flag when you land? Some things you could check: Are all your colliders 2D and set to be triggers?Have you checked your … Read more