0

Скрин ошибкиПопытался сделать что-бы камера следила за персонажем по X и Y но при этом была на 2.49 выше центра персонажа.

    using UnityEngine;

public class CamMove : MonoBehaviour
{
    public Transform player;
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").transform;
    }
    void Update()
    {
        float camY = player.transform.position.y+2.49;
        transform.position = new Vector2 (player.transform.position.x, camY);
    }
}

Выдаёт ошибку: error CS0266: Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?) Буду благодарен каждой попытке помочь.

6

1 ответ 1

2

добавьте f для литерала 2.49

float camY = player.transform.position.y+2.49f;

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.