Run scripts only when model loaded on AR Marker

I am working on a marker based AR project, but I am facing an issue that my scripts run even if I move my camera away from the marker. For example - If I am rotating a model using the script, the rotation continues even if I take my camera away from marker. I want my code to run only when the marker is detected, and the model is loaded on it. How should I do that?

P.S: Apologies that I can’t put the code in because of client privacy concerns.

I was under the impression that the AR Starter Kit disables/enables the children of the entity that has the arMarker script on marker detected/lost so this should be handled already.

At a rough guess, do you have the rotate script on the same entity as the one that has the arMarker script? If so, you should change it so that the script is attached to a child entity of the marker.

I checked… all you have to do is to add the children under the marker, and rest is taken care of out of the box for you. Thanks