mardi 8 décembre 2020

Is there an easy way to get out of this IF loop?

I'm learning how to program and I feel that I'm always trapped with this kind of loops problems. the question is, what would be the best way to get out of the if when the grouped bool is always true on Update (every frame). I need to execute the EUREKA only once.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GroupedWordsEyes : MonoBehaviour

{
    void Update()
    {
        //Check if words are grouped 
        bool grouped = CompareTags_Word1.colliding == true;

        if (grouped)
        {
            Debug.Log("EUREKAAAA!");
            //get out of the loop!
        }
    }
}

Aucun commentaire:

Enregistrer un commentaire