Hello,
I am trying make block breaker, in my code I add variable timesHit for record number of times ball hit the block which is increment when ball hit the block but does not show on Unity Editor.
using UnityEngine;
using System.Collections;
public class Brick : MonoBehaviour {
public int maxHits;
public int timesHit;
// Use this for initialization
void Start () {
timesHit = 0;
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter2D(Collision2D collision){
timesHit++;
print (timesHit);
}
}
The below timesHit++ in OnCollisonEnter2D method is printing correct but timesHit on Unity Editor does increment.!