I'm having some trouble getting my shooting to work in unity2D
I've attached a picture of my current code.
When the I release the down arrow key, a projectile should be spawning, but it's not.
I've entered two debug statements to try and figure out where my code is messing up. Step 1 is being reached, but when I release the down arrow key, step 2 isn't printing to the debug console and the projectile isn't instantiating.
What's also weird is that I have another script that makes an animation play when the down arrow key is released, and that's working perfectly.
Any help will be greatly appreciated.
yes. there are no errors printed to the screen.
Why don't you try :
if(Input.Get$$anonymous$$eyUp($$anonymous$$eyCode.DownArrow) && shootDelay.canShoot && Player.alive)
yes you're right. I changed it in my code. but I have figured somethings out that makes this situation even more odd.
Initially I had a PlayerSpawner object that would spawn my player when the level loaded. I took that out and just put my player prefab in the scene's hierarchy. I then removed the projectile spawner code from the player, and added it back again. It then all the sudden works. However when I save the scene, close out unity, and open the project, the problem is back again, and I have to remove the code and reapply it to get it to work.
Your answer
Follow this Question
Related Questions
Third person controller moving backwards when shooting 0 Answers
Another Alternating Weapon Fire issue.... 2 Answers
Character Shooting Mechanic 2D Issues 0 Answers
FPS Raycasting vs Instantiate 0 Answers