I can’t understand why my script is not working..I don’t get why this is wrong..this is my script code below.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class k : MonoBehaviour
{
void OnTriggerEnter(Collider collider)
{
if(collider.gameObject.name == "holms")
{
GameVariables.keyCount+=2;
Destroy(gameobject);
}
}
}
I was searching the internet to find similar issue and I find similar threads but not similar to this. It different from the other post here or in google search.
>Solution :
You mis-typed Destroy(gameObject)