Cuando trato de ejecutar mi juego me sale el siguiente error:
MissingRefferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Aquí esta mi código pero a decir verdad no se porque sucede el problema o a que se deba exactamente el problema.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DisparoMovimiento : MonoBehaviour {
public GameObject player;
private Transform playerTrans;
private Rigidbody2D DisparoRB;
public float DisparoSpeed;
public float bolitalife;
void Awake(){
DisparoRB = GetComponent<Rigidbody2D>();
player = GameObject.FindGameObjectWithTag("Player");
playerTrans = player.transform;
}
// Use this for initialization
void Start () {
if (playerTrans.localScale.x > 0){
DisparoRB.velocity = new Vector2(DisparoSpeed, DisparoRB.velocity.y);
transform.localScale = new Vector3(1, 1, 1);
}
else{
DisparoRB.velocity = new Vector2(-DisparoSpeed, DisparoRB.velocity.y);
transform.localScale = new Vector3(-1, 1, 1);
}
}
// Update is called once per frame
void Update(){
}
}
void update(){}