Please help me. Today I added Levels to my game. In first place the Unity Editor crashed one time (if this is helpful). But them I made a commit (after I changed the position of my static enemy and added level) and then I closed my Unity. Then I opened VSCode and nearly all of the code was marked as uncorrect.
using System.Collections; using System.Collections.Generic; using UnityEngine; public class WeaponBoardComputer : MonoBehaviour { public Transform bulletPos; public GameObject _bulletPrefab; private float _timer; private GameObject _player; private void Start() { _player = GameObject.FindGameObjectWithTag("Player"); } // Update is called once per frame void Update() { float distance = Vector2.Distance(transform.position, _player.transform.position); // Debug.Log(distance); if (distance < 30) { _timer += Time.deltaTime; if (_timer > 2) { _timer = 0; Shoot(); } } } void Shoot() { Instantiate(_bulletPrefab, bulletPos.position, Quaternion.identity); } }
Here's my Unity Project:
Here I can't see the enemy sprite (which is simple the Unity Deafult Sqaure).
Please help me!
Yours,
PingGames