- Home /
Question by
Vire · Apr 15, 2013 at 06:53 AM ·
cameracontroller
Camera Controller Script for 2.5D SideScroller Error
Hi, I have a potentially very basic problem but I don't know what the error means.
I attach this script to a camera, and put the character as the target. Then it complains:
Assets/Standard Assets/Scripts/User/CameraController.cs(8,67): error CS1061: Type
UnityEngine.Transform' does not contain a definition for x' and no extension method
x' of type UnityEngine.Transform' could be found (are you missing a using directive or an assembly reference?)
But I have no clue what that means. My script is basic, it tells it to make the translate X of the camera the same as the character, what's so hard about that that it has to complain?
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour {
public GameObject target;
void Update () {
transform.position = new Vector3(target.transform.x, 0, 0);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613100337im_/https://answers.unity.com/themes/thub/images/avi.jpg)