Y
Y
yaroslav56192021-06-18 19:10:42
C++ / C#
yaroslav5619, 2021-06-18 19:10:42

What is the error in my code?

1 using UnityEngine;
2
3 public class FolowCamera : MonoBehaviour
4 {
5 public transform player;
6 public Vector3 offset;
7
8 // Update is called once per frame
9 void Update()
10 {
11 transform.position = player.position + offset;
12
13 }
14 }

error in Unity:

Assets\FolowCamera.cs(5,12): error CS0246: The type or namespace name 'transform' could not be found (are you missing a using directive or an assembly reference?)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
MrSlowpoke, 2021-06-18
@yaroslav5619

transform capitalized
public Transform player;

S
stasersmailov, 2021-06-18
@stasersmailov

Send a screenshot from the unit itself, in my opinion you forgot to transfer the player to the script

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question