I'm making a game in Unity, and when the player walks past a sprite, the sprite disappears, and when the player walks back toward it, it reappears. You can see a video of the problem here https://www.youtube.com/watch?v=jgLN3m94tBo

I've also included my camera script below if anyone wants to check that out. Any help on this matter would be more than appreciated.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Camera : MonoBehaviour {

private Transform target;

private float minX = 7.99f;
private float minY = -19.09f;

public float maxX, maxY;

void Start()
    target = GameObject.Find("Player").transform;

void LateUpdate()

    transform.position = new Vector3(Mathf.Clamp(target.position.x, minX, maxX), Mathf.Clamp(target.position.y, minY, maxY), transform.position.z);

Here's a screenshot of my camera's settings

enter image description here

  • \$\begingroup\$ I don't think there's anything wrong with your follow script. Post a screenshot of the settings of the Camera itself. This kind of thing is usually due to something being misconfigured in the camera settings. \$\endgroup\$
    – Stephan
    Nov 17 '17 at 22:06
  • \$\begingroup\$ I'll try to post a screenshot, but everything is very basic. I didn't adjust the camera or anything. Could it have something to do with frustum culling? \$\endgroup\$
    – Sean Carey
    Nov 17 '17 at 23:16

It seems that the issue had to do with a plugin I was using to import my .tmx file into Unity. I switched to Tiled2Unity and the problem no longer persists.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.