Assigning a particle system to a variable

Original scripts Enemy AI

I can’t seem to track down Rob productions, he wrote this script and also ‘Invasion of the Trivials’

Anyhoo, I took the player from ‘Trivials’ and put it in a new project, then made an enemy with the enemymood and enemytarget.js

UnassignedReferenceException: The variable hitParticles of ‘enemytarget’ has not been assigned.
You probably need to assign the hitParticles variable of the enemytarget script in the inspector.
enemytarget.Start () (at Assets/Scripts/Mobs/enemytarget.js:35)

I’m not sure how to stick the ‘hit’ particles prefab (or any other prefab) onto the script, there’s nothing available when I try to load it from the menu,
I dragged the prefab into the scene, can’t drag it onto the Variable. How is this done anyway?

Thanks, Rob Productions, hope you don’t mind me copy-pasting, this is one of the few games I can understand at all.
4.2 MB

You’ll need ‘Character Controllers’ and ‘Particles’ packages added from Standard Assets

The variable hitParticles on the enemy script expects a ParticleEmitter, make sure whatever you are trying to drag into that slot has a ParticleEmitter component. It should be that simple.

My guess is you are trying to use the Shuriken particle system (which does not have a ‘ParticleEmitter’ component). You can either rewrite all instance of hitParticles to use the new particle system or create a particle system the old way. Here is the reference to the Legacy particle system.


Shuriken particle system
It wanted a particle emitter, thanks.