W
W
WasTabon2021-01-12 15:34:37
Unity
WasTabon, 2021-01-12 15:34:37

Why doesn't the coroutine stop and why does 1 mouse click count as 2?

public void ReDeletePlatforms(InputAction.CallbackContext context)
    {
        Debug.Log("Нажал");
        StopCoroutine(platformsCreate.Spawning());
        Debug.Log("Остановил корутину");
        destroyPlatforms2 = GameObject.FindGameObjectsWithTag("Platform");
        for (int i3 = 0; i3 < destroyPlatforms2.Length; i3++)
        {
            //Thread.Sleep(1000);
            Instantiate(destroyPlatforms2[i3], destroyPlatforms2[i3].transform.position, Quaternion.identity);
            destroyPlatforms2[i3].gameObject.tag = "PlatfomRealy";
            BoxCollider2D boxCollider2D;
            boxCollider2D = destroyPlatforms2[i3].GetComponent<BoxCollider2D>();
            boxCollider2D.isTrigger = false;
            Destroy(destroyPlatforms2[i3]);
        }
        StartCoroutine(platformsCreate.Spawning());
    }


This is what happens when you right click

5ffd974687030624256839.png

5ffd9759eb40f819795784.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-01-12
@freeExec

See how to use it correctly, it StopCoroutine(platformsCreate.Spawning());will not stop what you have started somewhere..

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question