D
D
DANICH702021-01-19 12:41:12
Unity
DANICH70, 2021-01-19 12:41:12

Error: transform.position assign attempt for "...." Input position is { Infinity, Infinity, Infinity }?

There was an error in the code, transform.position assign attempt for "...." Input position is { Infinity, Infinity, Infinity }. Tell me what's wrong?
the code:

using UnityEngine;
using System.Collections;
public class NewBehaviour : MonoBehaviour
{
    public GameObject player;
    public float speedRotation = 1;
    public float speed = 1;
    public float jumpSpeed = 1;
    float totalTime = 0;
    void Start()
    {
        player = (GameObject)this.gameObject;
    }
    void Update()
    {

        {
             player.transform.position += (-player.transform.right) * speed * Time.deltaTime;
        }

        totalTime += Time.deltaTime;
        if (totalTime > 5)
            speed *= 10;
    }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question