i know there are lots of questions on this but i dont know how to apply it to my code
using UnityEngine; using System.Collections;
public class FlyPickup : MonoBehaviour{
[SerializeField]
private GameObject pickupPrefab;
void OnTriggerEnter(Collider other)
{
// if the "Collider" other is tagged with "Player"...
if (other.CompareTag("Player"))
{
//...add the pickup particals
Instantiate(pickupPrefab, transform.position, Quaternion.identity);
//...Decrement the total number of flies..
FlySpawner.totalFlies--;
//... update the score
ScoreCounter.score++;
Destroy(gameObject);
}
}
}