Object disappear for a while when moving camera #2D

Hi, can i ask where i can fix this problem with moving camera, for example i want to change position of camera to place where player need to see what he changed with lever or button, and then camera switch back after certain of time, i have this

IEnumerator MoveCameraToDest()
{
iTween.MoveUpdate(cameraObj, destinationForCamera, 2f);
yield return new WaitForSeconds(2f);
iTween.MoveTo(cameraObj, cameraDefaultPos, 2f);
yield return null;
}

, it works nicely, but when camera go to position, then i see only moving gameobjects or only some of them and anything else disappear, but i can see those object when camera switch back. How can i fix this please? Thanks a lot :slight_smile:

2957684--219457--pic2.png 2957684--219458--pic3.png

and this is how it looks without error

2957686--219459--pic4.png

problem must be in iTween, because i try to move camera with player, i changed from transform.position = player.position in script which is included on camera gameobject and when i use iTween.MoveUpdate, then objects dissapear too immediately on start.

problem solved with
iTween.MoveUpdate(gameObject, new Vector3(player.position.x, player.position.y, -10), 1f);
i need to use specific vectors ‘x,y,z’ and not use position of player, because camera is on -10 and when i use player position then cmaera Z vector is broken.

1 Like