because i want to display an object when i catch it from falling or i mean the object will be set to true…sorry for my english i really appreciate your help,can anyone help me with this problem because i dont know what is missing this code… i just want to display an object when catch? i hope someone might help me with this…thank you
using UnityEngine;
using System.Collections;
public class setActive : MonoBehaviour
{
public GameObject objct;
void Start() {
//objct.gameObject.SetActive(false);
}
void OnTriggerEnter2D(Collider2D col)
{
if (col.gameObject.CompareTag("Player"))
{
objct.GetComponent<Renderer>().enabled = !objct.GetComponent<Renderer>().enabled;
objct.gameObject.SetActive(true);
}
}
}