///===///
GameObject Decal = Instantiate(GetGO(), hit.point + (hit.normal * .01f));
Decal.transform.SetParent(null); //под вопросом
///===///
GameObject GetGO()
{
return transform.GetChild(0).gameObject;
}
if (Input.GetMouseButtonDown(0))
{
Ray ray = _camera.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out RaycastHit hit))
{
if(hit.transform.gameObject.TryGetComponent(out EnemyCode enemy))
{
enemy.hit();
}
else
{
if (shootPF == null) Debug.LogError("Instance Bug");
GameObject Decal=Instantiate(shootPF,hit.point + (hit.normal * .01f));
Decal.transform.forward = -hit.normal;
Decal.transform.SetParent(hit.transform);
}
}
}
а ну Application.tagretframrate = 60 оставляем