My player model is invisible because of a line of code that wasnt turning it invisible before

So i am making a 2d platformer, and everything was working. I had the first level done and went to move on to the second level and all of a sudden when i go to play it, i cant see the player model despite it showing up in the game and scene tabs just fine. I tracked it down to 1 line of code, but that line of code has been in there since i started the project and has never caused any issues. Now whatever I change it to has no effect and unless i completely delete that line of code (in which case the camera no longer follows the player) im always invisible. Here is the script using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraFollow : MonoBehaviour { public GameObject target; // Update is called once per frame void Update() { //the line thats causing me to go invisible transform.position = new Vector3(target.transform.position.x, target.transform.position.y, -10); } }
1 Reply
Anchy
Anchy12mo ago
check your z position of the camera is in front of your model and not behind it
Want results from more Discord servers?
Add your server