Mail.ruПочтаМой МирОдноклассникиВКонтактеИгрыЗнакомстваНовостиКалендарьОблакоЗаметкиВсе проекты

Враг в Unity 2D

Яро Князь Князьков Ученик (112), на голосовании 7 месяцев назад
Помогите исправить ошибки в коде для Unity 2D, будьте добры!using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyFollow : MonoBehaviour
{
public float speed;
private Transform player;

void Start()
{
player - GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
}

void Update()
{
transform.position - Vector2.MoveTowards(transform.position, player.position, speed * Time.deltaTime);
}
}

Выдаёт ошибки. Я начинающий так, что плохо знаю об этом...
Голосование за лучший ответ
Malenkiuprinter Kpachemokoc Мастер (1709) 8 месяцев назад
 using System.Collections; 
using System.Collections.Generic;
using UnityEngine;

public class EnemyFollow : MonoBehaviour
{
public float speed;
private Transform player;

void Start()
{
player = GameObject.FindGameObjectWithTag("Player").GetComponent();
}

void Update()
{
transform.position = Vector2.MoveTowards(transform.position, player.position, speed * Time.deltaTime);
}
}
creakdowndeadly Мастер (1079) 8 месяцев назад
Здесь ошибка:

void Start()
{
player - GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
}
Похожие вопросы