Привет всем, при программировании у меня вылезла ошибка
error CS1061: 'GameObject' does not contain a definition for 'Transform' and no accessible extension method 'Transform' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?) Пожалуйста помогите исправить.
Вот код:
using UnityEngine;
public class FirstPersonMovment : MonoBehaviour
{
[Space]
[SerializeField] private float mouseSensitivity = 1f;
[SerializeField] private float smooth = 2f;
[Space]
[SerializeField] private float minClamp = 90f;
[SerializeField] private float maxClamp = -90f;
Transform character;
private Vector2 currentMouseLook;
private Vector2 appliedMousedelta;
Ошибка:private void Start() => character = GameObject.FindGameObjectWithTag("Player").Transform;
private void Update()
{
var smoothMouseDelta = Vector2.Scale(new Vector2(
Input.GetAxisRaw ("Mouse X"), Input.GetAxisRaw ("Mouse Y")), Vector2.one * mouseSensitivity * smooth);
appliedMousedelta = Vector2.Lerp(appliedMousedelta, smoothMouseDelta, 1 / smooth);
currentMouseLook += appliedMousedelta;
currentMouseLook.y = Mathf.Clamp(currentMouseLook.y, -minClamp ,maxClamp);
character.localRotation = Quaternion.AngleAxis(currentMouseLook.x, Vector3.up);
transform.localRotation = Quaternion.AngleAxis(-currentMouseLook.y, Vector2.up);
}
}