timer script

hello people,

i tried to make a script with a timer in it. this is what i got so far:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class timerscript : MonoBehaviour
{

    AsyncOperation ao;
    public GameObject controller;
    public GameObject arrow;
    public Text textcontinue;

    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if(timeLimit > 1)
        {
            timeLimit -= Time.deltaTime;
            GetComponent(GameObject.controller) = true;
            GetComponent(GameObject.arrow) = true;
            GetComponent(Text.textcontinue) = true;
        }
    }
}

what the result has to be: 3 components in my scene which are disabled by default, should switch to enabled in a timer script.

im not good at scripting so i hope someone can solve this for me.

What are you asking for? Solve what? From what I can tell you’re checking a timeLimit variable which is probably a float, but it doesn’t appear you posted your complete script around your timer.

Honestly, looking at what you want, is a timer really the best solution? If all you want is something to turn on after a few secs, you could easily do this with a coroutine or an invoke that calls a method to turn the components to enabled.

Is there a reason you want to do this with a timer?

looking at lines 26-28 you should probably have a look at

also

would probably be a good read given the class name you’ve used… start with good habits early :sunglasses:

i fixed it! thanks anyway