error CS0246: The type or namespace name `ParticleCollisionEvent' could not be found. Are you missing a using directive or an assembly reference?

I am trying to write a script where if the player pressed down on the mouse, a Boolean called “Hover” would equal yes. If the player object was “hovering” while in collision with my particle system, the player would rise in the y axis. However I get a namespace error on ParticleCollsionEvent which is weird since I’m adapting code from the Unity documentation page: Unity - Scripting API: MonoBehaviour.OnParticleCollision(GameObject) In addition, I’m also getting parsing and unexpected symbol errors which I’m not sure how to fix. Here is what I have so far:

using UnityEngine;
using System.Collections;

public class HoverScript : MonoBehaviour {

public float Hoverforce;
public ParticleSystem part;
public ParticleCollisionEvent[] collisionEvents;
public bool Hover;

// Use this for initialization
void Start () {
	part = GetComponent<ParticleSystem>();
	collisionEvents = new ParticleCollisionEvent[16];

}

// Update is called once per frame
void Update () {
	if (Input.GetKeyDown ("mouse0")) 
		Hover = true; 
}

void OnParticleCollison (GameObject other) {
	int safeLength = part.safeCollisionEventSize;
	if (collisionEvents.Length < safeLength)
		collisionEvents = new ParticleCollisionEvent[safeLength];

	int numCollisionEvents = part.GetCollisionEvents(other, collisionEvents);
	int i = 0;
	while (i < numCollisionEvents && Hover = true) {
		other.rigidbody.AddForce(Vector3.up * Hoverforce, ForceMode.Acceleration);
	}
	i++;

}

}

Any advice would be useful thanks!

When I tried your script I did not receive any such error as you stated. But there were unexpected symbol and parsing errors though.

In your while you should check for equality of Hover using ‘==’ as below:

while (i < numCollisionEvents && Hover == true) {

Also I think your

i++; 

should be inside your while loop and not outside.

Figured it out! For anyone not using Unity 5, you have to change ParticleCollisionEvent to ParticleSystem.CollisionEvent.

Figured it out! For anyone not using Unity 5, you have to change ParticleCollisionEvent to ParticleSystem.CollisionEvent.