Hi fellas and ladies, having an odd problem. I have a class called Partcle Handler. It’s job (at the moment) is very simple. It gets access to a script and tracks a state. If that state is of a certain value, it triggers the partile emmitter which is already attached to that object… See code below
using UnityEngine;
using System.Collections;
public class ParticleHandler : MonoBehaviour {
public ParticleEmitter myEmitter;
// Get access to PhysicsV2 component
public PhysicsV2 accessToPhysics;
//currently including this script makes the object disappear - it deletes it!
// Use this for initialization
void Start () {
myEmitter = GetComponent<ParticleEmitter>();
accessToPhysics = GetComponent<PhysicsV2 >();
}
// Update is called once per frame
void Update () {
if ( accessToPhysics.IsTheBlockMoving() == false )
{
print("");
myEmitter.emit = true;
}
else
{
myEmitter.emit = false;
}
}
}
The problem is, sometimes when it the line ‘myEmitter.emit = true;’ executes, it deletes the object that the script PhysicsV2 is attached to (can see this in the game and hierarchy view).
I’ve no idea why it would do this…any ideas?
Thanks!