перелазил кучу форумов, не могу найти как решить данную ошибку:
Assets\scripts\shoot.cs(29,26): error CS1061: 'RaycastHit' does not contain a definition for 'enemy_hp' and no accessible extension method 'enemy_hp' accepting a first argument of type 'RaycastHit' could be found (are you missing a using directive or an assembly reference?)
код:
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class shoot : MonoBehaviour { public int range; public GameObject cam; public ParticleSystem As;
Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, range); var Tag = hit.collider.tag; if (Tag == "nps") { var hp = hit.enemy_hp.hit; } } }