Hello I’ve been struggling for hours and I can’t fix this problem
I’m a newbie and I’m trying to make my script drop EXP after death of a monster
But problem is I can’t do that at all, I tried using Void Update and failed.
And then tried Coroutine which showed progress but problem exp is dropped right away from the start as if the “WaitUntil”,which should wait until monsters are dead, isn’t there.
Also I’m developing this script further on the CreatorKit Beginner(which is making me struggle a lot)
using System;
using CreatorKitCodeInternal;
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
using Random = UnityEngine.Random;
namespace CreatorKitCode
{
public class XPDrop : MonoBehaviour
{
public StatSystem Stats;
// Start is called before the first frame update
void Start()
{
StartCoroutine(DropXP());
}
// Update is called once per frame
void Update()
{
}
IEnumerator DropXP()
{
yield return new WaitUntil(DEAD);
XPManager.instance.AddXP(100);
}
bool DEAD()
{
if(Stats.CurrentHealth == 0)
{
return true;
}
else
{
return false;
}
}
}
}
Please help me cause I’m really sad after spending lots of hours trying to fix it but failing miserably at least if I can’t fix this directly, I want to make a new one that drops experience and honestly this is really disappointing.