Question by
unity_user_223 · Oct 20, 2018 at 08:05 AM ·
c#int
Hellp int - a int not working
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class shock_wave_2 : MonoBehaviour {
part_Hellth hp;
[SerializeField]
int hit_hp = 20;
private void OnControllerColliderHit(ControllerColliderHit hit)
{
if (hit.gameObject.name == "part")
{
hp = hit.gameObject.GetComponent<part_Hellth>();
hp.HP = hp.HP - hit_hp;
}
}
}
it gave me no Errors but part_Hellth.HP did not go dawn.
Comment
Best Answer
Answer by unity_user_223 · Oct 20, 2018 at 11:09 AM
fixed i used private void OnControllerColliderHit(ControllerColliderHit hit)
in stead of private void OnCollisionEnter(Collision hit)
Your answer
