- Home /
i dont know what i did wrong, anyhelp please?
Problem--- the small slot to drag the player onto.. via cameracontrollerscript, to assign the object reference..is not appearing. and this line ---> ((offset = Transform.position - player.transform.position; )) seems to be having trouble.. MY SCRIPT----
using UnityEngine;
public class cameracontrol : MonoBehaviour {
public GameObject player;
private Vector3 offset;
//
void start ()
{
offset = Transform.position - player.transform.position;
}
void LateUpdate()
{
transform.position = player.transform.position + offset;
}
},my script,
using UnityEngine;
public class cameracontrol : MonoBehaviour {
public GameObject player;
private Vector3 offset;
//
void start ()
{
offset = Transform.position - player.transform.position;
}
void LateUpdate()
{
transform.position = player.transform.position + offset;
}
}
very basic question, not meant to demean, have you dragged the script itself onto the initial object that holds the script? if so, did you save the script after you added the gameobject player.
Answer by alexanderyork · Apr 20, 2019 at 11:52 PM
selected main camera-add component-new script, and yes saved.. and no worries, I am very new to this. :) thank you for quick response.
I fixed it.. sorry all, was a simple newb scripting thing.. I did not grab the ...namespace I think its called, for "position" was untagged for lack of knowing a better way of saying it. thanks anyways
Answer by gwnguy · Apr 21, 2019 at 01:22 AM
I'm assuming you also capitalized the word start in "void start ()" (i.e. "void Start ()")
Your answer
Follow this Question
Related Questions
Help me to avoid the camera to discover the world boundary 1 Answer
Check if camera have a post-profile 0 Answers
script works with orthographic camera but not with perspective 0 Answers
How do you change the values of Vector3 Offset (x, y, z) in script randomly/overtime? 0 Answers
Sebastian Lague Character Creation Tutorial animations not being triggered 0 Answers