Hi,
I have an EffectsManager script set on an empty object in my hierarchy. At runtime, I call…
public void TerminateEnemy()
{
_shotObject = _raycastManager.GetCurrentFoundObject();
StopEnemyActions();
StartCoroutine(FadeEffect());
}
private void StopEnemyActions()
{
// TODO AttackDroneActions is null
_shotObject.GetComponent<AttackDroneActions>().IsShot = true;
}
Before anyone asks, yes, _shotObject is declared as a class variable.
The AttackDroneActions script is a script placed on a drone prefab. Inside that script, I’ve set up a private bool _isShot with a getter and setter. There are several attack drones that are set to active at runtime (I’m pooling objects). When a player shoots a drone, I’m trying to stop the actions of that particular drone instance. I’ve googled a bit and research shows that the code in StopEnemyActions() should work but it does not as AttackDroneActions shows as null. I am stuck. Help, thanks!