Solucionado (ver solução)
Solucionado
(ver solução)
7
respostas

Erro que esta dando (43,17): error CS0103 - Dou play e nao roda o jogo

using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Security.Cryptography;
using System.Threading;
using UnityEngine;

public class ControlaInimigo : MonoBehaviour{

    public GameObject Jogador;
    public float Velocidade = 5;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update() {
    }

    void FixedUpdate() {

        float distancia = Vector3.Distance(transform.position, Jogador.transform.position);

        Vector3 direcao = Jogador.transform.position - transform.position;

        Quaternion novaRotacao = Quaternion.LookRotation(direcao);
        GetComponent<Rigidbody>().MoveRotation(novaRotacao);


        if (distancia > 2.5) { 

            GetComponent<Rigidbody>().MovePosition
            (GetComponent<Rigidbody>().position +
            direcao.normalized * Velocidade * Time.deltaTime);

            GetComponent<Animator>().SetBool("Atacando", false);
        }
        else
        {
            GetComponent<Animator>().SetBool("Atacando", true);
        }
    }

    void AtacaJogador()
    {
        Time.timeScale = 0;
        Jogador.GetComponent<ControlaJogador>().TextoGameOver.SetActive(true);
        Jogador.GetComponent<ControlaJogador>().Vivo = false;

    }
}
7 respostas

Oi, Marcio, tudo bem?

Pode colar aqui todos os erros que aparecem na janela de Console completos?

Você pode acessar essa janela em Window > Console

Assets\Scripts\ControlaJogador.cs(43,17): error CS0103: The name 'SceneManagement' does not exist in the current context

Oi, Marcio, tudo bem?

Parece que o erro está em outro script no ControlaJogador deve ter faltado um using UnityEngine.SceneManagement; lá no começo do script.

Ola
Testei todos e confirmei, nao é isso

using System.Collections; using UnityEngine.SceneManagement; using System.Collections.Generic; using System.Collections.Specialized; using System.Security.Cryptography; using System.Threading; using UnityEngine;

using System.Collections;
using UnityEngine.SceneManagement;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Security.Cryptography;
using System.Threading;
using UnityEngine;
solução!

Oi, Marcio, tudo bem?

Você consegue fazer um .zip do seu projeto atualizado e colocar num Google Drive, Dropbox, etc como publico e colocar o link aqui pra gente dar uma olhada?

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software