Make icon ReEnable after it has been picked up?,Random ReEnable of health pickup after it has been picked up?
First off, I am HORRIBLE with this programming thing. Half of the vocabulary I don't immediately understand still. But here's my issue.
I have a health icon that will disappear (using setActive false) when a Player tag is detected over it. I need the same icon to re appear after a random time between 3 and 10 seconds, however. Here's the trigger code so far.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HealthTrigger : MonoBehaviour {
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
gameObject.SetActive(false);
}
}
}
From what I gathered online so far, I need to use a coroutine called IEnumerator with WaitForSeconds range or something. However I haven't the slightest clue how to set this up so that it will re enable the icon after it has been picked up.
Any help would be appreciated!
Your answer
Follow this Question
Related Questions
How to preserve Y rotation while setting transform.up? 1 Answer
.rotation doesn't seem to work, can't shoot projectile at mouse coordinates 0 Answers
Rotate Object based on distance to destination 1 Answer
X Rotation randomly jumps to 90? 0 Answers
[SOLVED] - Issues with Character Controller and Moving Platform 1 Answer