var flames : GameObject = GameObject.Find("Fireball");
being the particle emiter object
I am begining to believe i may need to instantiate the object and destroy it when i’m done but i don’t really want to use that method.
i would much prefer the .emit = true; method as it makes more sense but declaring .emit = false; causes it to remove the object so it seems like a F@*XD if i do, F@*XD if i don’t situation. so any help or advice would be much appreciated thanks again.
i’m also having a little trouble implementing this example you gave me lol i’m a dumbass.
i’ve tried the unity scripting refs but they seem very vague to me and any time i have used it there seems to be minor errors that drive me nuts for days eg: Animation.Play(scripting ref) when it realy is animation.Play.
var flames : GameObject = GameObject.Find("Fireball");
i tried moving it to inside the function and the error went away woo hoo but all the method bugs above continue(removing object after with .emit =false; / visible particles with .enabled =false;)
IT JUST KILLED UNITY!!!
well not really the whole thing froze when i pressed play
i’ve tried a few times and it produces the same results.
frozen solid…
hmmmm
i get the methodology
and it should work
This is going to be the direct logic but altered to fit the situation. Using the same script base again, but this time I’m gonna go line by line. If this doesn’t work, then we can assume the Unity gods are unhappy with us, and I will track down a sacrificial goat.
Create a new script named FireCollider.js. Put the following code into it and attach it to the same object as the script you provided.
var onFire = false;
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if (hit.gameObject.tag == "Firepit")
{
onFire = true;
Debug.Log ("I'm on FIRE");
yield WaitForSeconds (2);
Debug.Log ("Oh Wait");
onFire = false;
Debug.Log ("No i'm fine");
}
}
Alter the script we’ve been trying to fix to have this code:
function Start() {
var emittedFlames : Component[] = GameObject.Find("Fireball").GetComponents(ParticleEmitter);
var fireColliderVars : FireCollider = GetComponent(FireCollider);
for (var p : ParticleEmitter in emittedFlames)
{
p.emit = false;
}
while(true) {
var onFire = fireColliderVars.onFire;
for (var p : ParticleEmitter in emittedFlames)
{
p.emit = onFire;
}
yield;
}
}
Maybe that yield was needed all along. Overlooked that last time. Anyways, these 2 scripts mimic the main logic and concepts of the example. There’s an external script that controls the boolean that turns the effect on and off. These gave me no compile errors. Hopefully they will work.
This is the project I was pulling the code from. Give it a good look over (including the PDF). Hopefully it may spark something, like something missing in inspector settings and all.
Unfortunately, I don’t have a lot of experience with particle stuff. It’s on my todo list that never seems to get any shorter.
I actually had this up in the background for the last few days i’ve been working through the tutorial as an exercise in my spare time it turns out that the Autodestruct box on the Particle Animator was checked :evil: sorry for the waste of time but at least this was a good learning exercise and we both just learned 3 new methods to do the same thing :P.
thanks for the help