- Home /
This question was
closed Jun 03, 2014 at 12:51 PM by
fafase for the following reason:
The question is answered, right answer was accepted
Question by
crispycret · Jun 03, 2014 at 11:26 AM ·
c#cameracomponentsmoothfollowcamera.main
C# Camera.main.GetComponent: Unknown Word SmoothFollow
I am trying to access the SmoothFollow Component on the Main Camera to modify the target in a script. The SmoothFollow Keyword is not defined in the monodevelop text editor.
Do I need to import anything to gain access to components?
Script.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class GameManager : MonoBehaviour
{
// Use this for initialization
void Start ()
{ }
// Update is called once per frame
void Update ()
{
// Error Here: SmoothFollow.target
Camera.main.GetComponent<SmoothFollow>.target = transform;
}
}
Comment
Change the following line:
Camera.main.GetComponent.target = transform;
to Camera.main.GetComponent().target = transform;
Follow this Question
Related Questions
Full screen camera missing? 3 Answers
CinemachineBrain component reference 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Smooth Camera follow script is causing framerate drops when moving 1 Answer