Iv’e tried several things and nothing seems to work.
During various trials and attempts I’ve gotten errors ranging from Object doesn’t exist in that form to :
My mission: To have a camera follow an object, and if possible utilize that camera from the objects vantage.
My scary noob script I have located on my main camera:
using UnityEngine;
using System.Collections;
public class camerabehaviorScript : MonoBehaviour {
public Camera allcameraData;
private Vector3 offset = new Vector3 (0,6,-10);
void Start ()
{
//Player Character Shape is the name of the cube I am using under the game object Player Character Object.
GameObject characterShape = GameObject.Find ("Player Character Shape");
Transform characterTransform = characterShape.transform;
Vector3 characterPosition = characterTransform.position;
}
void Update ()
{
allcameraData.transform.position = characterPosition + offset;
}
}
Currently the error in Unity states:
“Assets/Player Character Folder/Character Camera Folder/camerabehaviorScript.cs(19,52): error CS0103: The name `characterPosition’ does not exist in the current context”
I am utterly lost now on the entire retrieval and “use of” positions, object attributes, Getcomponent calling. I do have 1 quarter of very basic “unity scripting” under my college belt.
However I have a feeling this issue runs deeper in my comprehension of even how variables function (which I thought I had a very good understanding of).
As an aspie, I would rather just ask than beat my head against a wall for another day or 2 settling for some nub chump script that runs like crap.
Any basic solves, or a quick guide on C# vs Unity use and concepts?