Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

unity says I have 2 update functions but I don't

$
0
0
heres my code im really confused i dont know what to do and i also have the same problem but for start using System.Collections; using System.Collections.Generic; using UnityEngine; public class EnemyBullets : MonoBehaviour { private GameObject player; private Rigidbody2D rb; public float force; void Start() { player = GameObject.FindGameObjectWithTag("Player"); Vector3 direction = player.transform.position - transform.position; rb.velocity = new Vector2(direction.x, direction.y).normalized * force; } void Update () { timer += Time.deltaTime; if(timer > 10) { die(); } } void OnTriggerEnter2D (Collider2D hitInfo) { if(other.gameObject.CompareTag("Player")) { die(); } } private void die() { Destroy(gameObject); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>