Calling a code somewhere

I want to run a code once.

For example, in this code, I want it to run once, no matter how much the main object is worth.

        if(result.other.tags.has("1")&& this.count ==2 )
     {

     }

Not sure if I understood the question, but if you want to make sure that some part of the code runs only once no matter what happens, you can use a boolean like this :

var hasRunOnce = false;
if(!hasRunOnce && result.other.tags.has("1") && this.count ==2 )
{
    //Do something here

    hasRunOnce = true;
}

And make sure that this boolean is set to false only at runtime, and not in a function that will be called several times.

1 Like

Do I have a chance to close the rigidbody with the code?

Not sure I understand again :slight_smile:
I haven’t used rigidbodies yet but what do you mean by “closing” the rigidbody?