Falling10fruit
Falling10fruit

Reputation: 319

When camera position set to object's, camera doesn't work

I have a camera with all of the default settings with the following C# script below

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Camera1 : MonoBehaviour
{
    // Update is called once per frame
    void Update()
    {
        transform.position = GameObject.Find("Thing").transform.position;

    }
}

The project runs normally (The player still moves), but I get this

Screenshot of the project running

Upvotes: 1

Views: 163

Answers (1)

Wondus
Wondus

Reputation: 41

Under the culling mask you need to create a layer for the gameObject your camera is set to follow, otherwise it will not see through it. You can also set its transform position just to be above/in front of it.

Upvotes: 1

Related Questions