Hi.
I’m doing a spinner and i want to detect the last slot the needle touch, because i need to launch an event after the spinner stops.
void OnTriggerStay2D(Collider2D col)
{
if (!_spinner.isStoped)
return;
if (col.gameObject.tag == ("1")) SpinPosition = 1;
if (col.gameObject.tag == ("2")) SpinPosition = 2;
if (col.gameObject.tag == ("3")) SpinPosition = 3;
if (col.gameObject.tag == ("4")) SpinPosition = 4;
if (col.gameObject.tag == ("5")) SpinPosition = 5;
if (col.gameObject.tag == ("6")) SpinPosition = 6;
if (col.gameObject.tag == ("7")) SpinPosition = 7;
}
void SpinCheck ()
{
switch (SpinPosition)
{
case 1:
Debug.Log("Slot 1");
break;
case 2:
Debug.Log("Slot 2");
break;
case 3:
Debug.Log("Slot 3");
break;
case 4:
Debug.Log("Slot 4");
break;
case 5:
Debug.Log("Slot 5");
break;
case 6:
Debug.Log("Slot 6");
break;
case 7:
Debug.Log("Slot 7");
break;
}
}
So, the thing is that, debug log keeps printing the event like this:
i ned it to be called just once.