#error
1 messages · Page 1 of 1 (latest)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Camara : MonoBehaviour
{
public GameObject John;
void Update()
{
position.x = John.transform.position.x;
transform.position = position;
}
}
is position a variable? I don't see it being declared anywhere.
So I assume you need to do something like ```Vector3 position = new Vector3();
position.x = John.transform.position.x;
transform.position = position;
Of course, position.y and position.z are going to be 0, so transform.position will be set to (John.transform.position.x, 0, 0)