WaitForSeconds (532759)

I found this useful documentation:
file:///C:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/Documentation/ScriptReference/WaitForSeconds-ctor.html

I tried it out, yet surprisingly, I found it did now work!

using UnityEngine;
using System.Collections;

public class Mover : MonoBehaviour {
	IEnumerator Example(){
		yield return new WaitForSeconds(5);
		Debug.Log("hi");
	} }

Sorry, I kinda messed that up… didn’t I… but anyways, I would love if someone could provide a solution to my problem!

What problem? You didn’t say what you are trying to do, or ask a question.

How are you calling “Example()”, to test it?

If this is C# and you’re just going “Example();”, then that won’t work. You need to use"StartCoroutine(Example());"

Oh, lol, I guess that wiki page forgot to add that XD

Ok, I am confused, I keep getting errors.
This is what I’m trying to accomplish:
The script to wait 5 seconds before doing anything after it.
(only in that script, not the other ones)

Can you show us what you’ve tried? A copy-paste of some example code doesn’t get us far. :wink:

lol, and of course, sry I didnt before:

void Start(){
yield return new WaitForSeconds(5);
DestroyObject(this.gameObject);
}

It won’t let you use it directly inside Start

You have to use it in a Coroutine and then start the coroutine from the Start() function, if that’s where you want it.