In my game, I have a sprite (mainCharacter) that is controlled by the user and a camera that follows the mainCharacter. I also have another sprite (object) that does not move with the camera or the mainCharacter. When the mainCharacter walks far enough that the object is no longer in the camera view and thus cannot be seen by the user, I want to trigger an action. How would I go about doing this?
I currently have four sprites (edges) that are anchored to the four sides of the screen/camera view. When the object collides with one of the edges, an action is triggered. However, in order to keep the edges stationary, I put the edges in a separate layer than that of the camera, object, and mainCharacter - although this strategy doesn’t seem to work.