need help please

I’m trying to create a delay between the start button press and the scene transition … Anyone know why it doesn’t work?

using UnityEngine;
using UnityEngine.SceneManagement;
using TMPro;
using System.Collections;

/// <summary>
/// Controling scene
/// </summary>
public class SceneManeger : MonoBehaviour
{
    private bool _press = false; //check if press
    public TextMeshProUGUI start; //Start menu font
    private float _wait = 3.0f; //delay


    private void Update()
    {
        CheckPress();
    }

    public void LoadScene(string sceneLoad)
    {
        _press = true; //start CheckPress()
        Debug.Log("button was pressed");

        StartCoroutine(WaitSec(_wait)); //delay between change scene
        Debug.Log("corutine Start");

        SceneManager.LoadScene(sceneLoad); //Load GameMode scene
        print("Scene Load");
    }

    //Method to change the font size if start button press
    void CheckPress()
    {
        if (_press == true)
            start.fontSize = 45;
    }

    // make delay between butten press and scene load
    IEnumerator WaitSec(float sec)
    {
        yield return new WaitForSeconds(sec);
    }


}

Can’t help you if you don’t post your code.

And since you’re new here, make sure you use code tags when you do (see first sticky post).

Also, tell us what “doesn’t work” means.

yes i fix this tnx

StartCoroutine doesn’t, on its own, actually wait for the specified time; it just kicks off the coroutine. The code then continues on uninterrupted. You need to put lines 28-31 in the WaitSec function itself.

and doesn’t work means that the delay between the bottun press and change scene not happan

ok thank you!

Out of curiosity: instead of using a Co-Routine and all that - why don’t you jsut use

Invoke(methodname, delay);

with a delay of 3 seconds?

I agree.

But it is already fixed

How did you fix your issue? Typically it’s proper on the forum to post how you solved your issue, and perhaps add [Solved] to the post title.