please help i am geting error cs1061
am getting this message in my unity for my script and i am lost
Assets/Camera Controller.cs(17,53): error CS1061: Type `Unity Engine.Game Object' does not contain a definition for transom
please help
using Unity Engine; using System.Collections;
public class CameraController : MonoBehaviour {
public GameObject player;
private Vector3 offset ;
void Start ( )
{
offset = transform.position - player.transform.position;
}
void LateUpdate ( )
{
transform.position = player.transfom.position + offset;
}
}
using UnityEngine; using System.Collections;
public class CameraController : $$anonymous$$onoBehaviour {
public GameObject player;
private Vector3 offset ;
void Start ( )
{
offset = transform.position - player.transform.position;
}
void LateUpdate ( )
{
transform.position = player.transfom.position + offset;
}
}
Answer by Namey5 · Nov 19, 2016 at 08:31 AM
There is a typographical error in your second reference to the player object's transform component, causing the error.
using UnityEngine;
using System.Collections;
public class CameraController : MonoBehaviour
{
public GameObject player;
private Vector3 offset;
void Start ()
{
offset = transform.position - player.transform.position;
}
void LateUpdate ()
{
transform.position = player.transform.position + offset;
}
}
Your answer
Follow this Question
Related Questions
Smooth camera movement by mouse 0 Answers
Camera Movement Question - How to follow player in Y axis only above certain threshold? 0 Answers
How do I make a dash attack while doing a top down 2d game 0 Answers
Is there a way I can make one script for all my buttons in my game? 1 Answer
Sprite not moving properly? 0 Answers