fix this without making extra scripts public void Enqueue(IEnumerator action) { lock…
- User
fix this without making extra scripts
public void Enqueue(IEnumerator action) { lock (_executionQueue) { _executionQueue.Enqueue(() => { try { StartCoroutine(action); // ERROR: NullReferenceException: Object reference not set to an instance of an object. } catch {
code} }); }}
- Assistant
- User
this isnt killing the object in the desired time should I use int?
using NUnit.Framework.Constraints; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine;
public class DestroyObjectZ : MonoBehaviour { public GameObject ObjectToDie; public bool DelayKill; public float DelayKillTime;
codepublic void KillIt() { Destroy(ObjectToDie); } public void DelayKillIt() { StartCoroutine(DelayTheKill(DelayKillTime)); } public IEnumerator DelayTheKill(float time) { yield return new WaitForSeconds(time); DelayKill = true; }}
- Assistant
It seems like your
DelayKillItmethod is set up to introduce a delay before killing the specified game object. However, the call is missing in the coroutine after waiting for the specified delay. Additionally, you should also ensure that the variable actually serves its intended purpose in the logic of your script.