ok so i try to create a basic fire spell using a mesh particle emmiter prefab that i created. it works inside the unity program but not on the built exe. At first i though it was my menu feature that was causing the problem, not the case, tried running without the menu same problem. this is the spell script i used`#pragma strict
var spell:Transform; var cooldown:float = 1.5; private var castimen : float = 0.5; var mana: int = 50; var spellsound: AudioClip; var charges: AudioClip; var oom: boolean = false; function Update () { if(Input.GetButton("Fire1")&&Time.time > castimen) { if(mana > 0){ Cast(); } else{ return; } } if(Input.GetButton("Charge")){ if (oom){ charge(); } } if(mana<=0){ oom = true; } else{ oom = false; } } function Cast(){ audio.PlayOneShot(spellsound); castimen = Time.time + cooldown; var shot = Instantiate(spell, transform.position, Quaternion.identity); shot.rigidbody.AddForce (transform.forward * 3000); mana--; } function charge(){ audio.PlayOneShot(charges); mana = 50; }
` please help i’ve no idea where to go from here.
thanks for your comments, what i am trying to do is instantiate the object “Spell1” as a rigid body and add force in the forward direction, however when it is built the object never even appears, also the object itself has a script attached to it that tells it to destroy itself after 3 seconds.