|
Hi I am making a 2d side scroller where my ship has 3 forms. The forms are changed using Input.GetKeyDown. When my player's ship enters for instance Fire form, I would like a Particle System to envelop the players ship with a red colored aura. My problem is since I have 3 elemental auras and one ultimate aura I need to be able to tell Unity which Aura Prefab to attach to the player at the moment of input. Also how do you "stick" it to the ship so after it has changed forms the aura stays around the ship while its moving, instead of just staying at the point where it was "called" Alot of this script isnt finished so some of the statements dont do anything yet. Thanks for the help.
(comments are locked)
|
|
As it is sometimes usefull to instantiate a prefab on input ( => Instantiate(prefab, pos, Quaternion.identity).transform.parent = transform.parent), this isn't the case here. You should have all the particle systems you need as children of your ship. If it's Shuriken, make sure they don't pley on awake, if it's legacy they must have emit disabled. Then Play / Emit the one you need when you need it. About sticking part, try changing the space of the particle system.
(comments are locked)
|
|
Thanks for your input guys, I understand the concept your trying to convey I just don't really understand how to execute it properly. I made the changes to my code suggested, I parent'ed my player's ship to the auras, turned the aura's emit off, and cleaned up the boolean code like suggested but I'm getting an error saying "MissingFieldException: Field 'CompilerGenerated.__playerScriptUpdate$callable1$9336.particleEmitters' not found." I know it's a simple solution from here but I am only a month into learning Unity/Jscript coming from Java. this playerScript is attached to my player game object, in the inspector I have added the auras into the element fields in the correct order. Im thinking my problem is how I'm initializing the array. Also having trouble getting to the emit in each of the children and setting it to true. I have attached the relevant code... thanks for your help. Instead of calling GetComponentInChildren.particleEmitters[2]..... you just call the array of which these components populate. So, just call Since the array is containing these components already. Im not sure you want(or can call) Update(), it gets called all the time anyway. Id remove that. Also, i dont see the var for iKD. just add it at the top, unless you excluded it for this post.
Mar 29 '12 at 04:15 AM
hijinxbassist
(comments are locked)
|

You need to go on the reference script for Mouse input . The proper way to use it is Input.GetMouseButtonDown(0); also, you cannot (x || y) you need to write the whole command for each key. At least I have never seen it before.