Unity выдаёт ошибку: 'slenderAI' does not contain a definition for 'position' and no accessible extension method 'position' accepting a first argument of type 'slenderAI' could be found (are you missing a using directive or an assembly reference?)
Вот такой код:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class slenderAI : MonoBehaviour
{
public Transform dest1, dest2, dest3, player;
bool teleporting = true;
public float teleportRate;
private int randNum;
void start()
{
StartCoroutine(teleport());
}
void Update()
{
this.transform.LookAt(new Vector3(player.position.x,this.position.y,player.position.z)); Пишет что ошибка в этой строчке
}
IEnumerator teleport()
{
while(teleporting == true)
{
yield return new WaitForSeconds(teleportRate);
randNum = Random.Range(0,3);
if(randNum == 0){
this.transform.position = dest1.position;
}
if(randNum == 1){
this.transform.position = dest2.position;
}
if(randNum == 2){
this.transform.position = dest3.position;
}
}
}
}
Если в отмеченной строчке убрать player.position.x и player.position.y, то ошибка пропадает. Помогите