Moving object (up,down,left,right-accomplished).object should not leave camera view(orthographic).another way than hardcoding ?

i want to move an object.i have accomplished.i also want to make the object never leave the camera view(orthographic view).how do i do it ?

i read smth,and understood that i have to attach the camera to the object first and then use the specific methods.

There are built in functions, I think they’re called OnVisible and OnInvisible. look them up, I think that’s what you want.