how to make a code run in every 10 frame not every frame

hi.

i have a function that is a checking function. it only need to be updated just one or 2 time every frames. how can i run a code just in those frames

For frames you could do this:
void Frame10Update() {
Debug.Log(“Every 10th frame”);
}

private int frames = 0;

void Update() {
    frames++;
    if (frames % 10 == 0) { //If the remainder of the current frame divided by 10 is 0 run the function.
        Frame10Update();
    }
}

I would not recommend incrementing each frame, if your player leaves that scene open, and the game is running for admittedly linger than usual you run the risk of overflow, then your if statement will offset a certain amount it’ll be a small bug but it’s definitely not good to untilize an overflowing integer. It just seems like bad practice. Maybe just reset frames after the if statement.

You’ve got two options: InvokeRepeating() or Coroutines with yield WaitForSeconds. They’re both discussed extensively on this site, in the documentation, and elsewhere.