2D Projectiles in Unity - Tutorial

  Рет қаралды 6,464

UnPaws Games

UnPaws Games

Күн бұрын

Пікірлер: 38
@AliceEverglade
@AliceEverglade 7 ай бұрын
watching this at midnight was a bad idea. I actually got flashbanged by ur visual studio xD
@UnPawsGames
@UnPawsGames 7 ай бұрын
🤣😅
@g-han5565
@g-han5565 7 ай бұрын
Damn... This is the type of tutorial which interests me. A very unique and reusable system. I'll be waiting for more tutorials then...
@ECAKJ
@ECAKJ 7 ай бұрын
You read my mind! This looks awesome. I’ve always wanted you to make tutorials. I’m curious how you did this in hidden tactics, along with how you did the animations since there’s a lot of weapons on seperate sprites. I’m still somewhat of a beginner
@roberto1899
@roberto1899 7 ай бұрын
I think you have a good tutorial voice.
@GarnetKane
@GarnetKane 4 ай бұрын
Incredible tutorial - this was awesome, so well explained, paced everything. Loved it, thanks so much my friend! Easiest sub of my life. Appreciate it
@UnPawsGames
@UnPawsGames 4 ай бұрын
Thanks a lot! You're welcome, I'm glad I could help 😊
@jugibur2117
@jugibur2117 11 күн бұрын
Cool, thanks for sharing!
@isaacpapillon8098
@isaacpapillon8098 7 ай бұрын
I keep getting null reference exeption on every part of the code that reference the target but I set the target correctly I dont understand.
@縁の翼
@縁の翼 2 ай бұрын
Such· a excellent video!!!!
@EinfachMichii
@EinfachMichii 7 ай бұрын
Actuallly nice system. To improve it even further (performance wise), try to limit the amounts of scripts (MonoBehaviours). It might become pretty important, even in your game when you've got a insane amount of projectiles in the scene. Also think about Object Pooling, which is commonly used for systems like that. Great Job!
@ECAKJ
@ECAKJ 7 ай бұрын
yes object pooling would be a good addition for sure
@UnPawsGames
@UnPawsGames 7 ай бұрын
Yep object pooling would be a great addition ! Thanks for your comment 😁
@mitsuhagd
@mitsuhagd 5 ай бұрын
I think you were a very good student at math
@jutekpixel
@jutekpixel 7 ай бұрын
Really awesome :)
@avadakedavra-qz1dc
@avadakedavra-qz1dc 2 ай бұрын
Can you make a tutorial for 3d isometric game?
@ECAKJ
@ECAKJ 7 ай бұрын
Also curious how you change sprites on runtime. Like in Starve when you cut down trees or your last jam game with the plants growing
@UnPawsGames
@UnPawsGames 7 ай бұрын
You can serialize the sprite renderer and different sprites, then set the spriteRenderer.sprite at runtime whenever you need it !
@ECAKJ
@ECAKJ 7 ай бұрын
@@UnPawsGames sweet! Ill try to figure out how to do that. Thanks!
@pixgamesstudio5884
@pixgamesstudio5884 7 ай бұрын
I can't seem to get it working when the enemies are moving
@UnPawsGames
@UnPawsGames 7 ай бұрын
What do you mean by not working ?
@ECAKJ
@ECAKJ 7 ай бұрын
Odds you can put the scripts in the description? I have no idea what Im doing wrong but I can not get it to work. I feel dumb, but trying to learn.
@UnPawsGames
@UnPawsGames 7 ай бұрын
I just added them ! I hope it helps :)
@ECAKJ
@ECAKJ 7 ай бұрын
@@UnPawsGames you’re the best! Thank you
@gabinchollet8153
@gabinchollet8153 6 ай бұрын
Hi ! Thanks for the tutorial its very nice but i have a problem the projectile stay on the position of the shooter, it seem that he as no target so i retry and retry but it's still doesn't work, can someone help me ?
@gabinchollet8153
@gabinchollet8153 6 ай бұрын
I usualy dont do that but i copy paste the scripts you put in the description but it dont work too
@UnPawsGames
@UnPawsGames 6 ай бұрын
Hi ! For more help, feel free to join my discord server (its in many of my video's decription). Peoplr there will be glad to help you :)
@gabinchollet8153
@gabinchollet8153 6 ай бұрын
@@UnPawsGames ok i'l join it thanks !
@albertcleetus7241
@albertcleetus7241 3 ай бұрын
i can't join your discord, it showing my mailId is already registered while claim my account.
@UnPawsGames
@UnPawsGames 3 ай бұрын
That's weird 🤔 Did you try the link in my latest videos?
@ECAKJ
@ECAKJ 7 ай бұрын
how can I set a new target?
@UnPawsGames
@UnPawsGames 7 ай бұрын
You can do that through script! For example, find a new target using a detection method and replace the target in your script!
@ECAKJ
@ECAKJ 7 ай бұрын
@@UnPawsGames thanks! I have a detection method, I guess im still too much of a beginner. I don’t know how to replace the target in script. How did you learn programming so fast?
@UnPawsGames
@UnPawsGames 7 ай бұрын
@@ECAKJ You can go for : target = newTarget in you script, whenever your condition to change target is fulfilled. I'm full-time, so that gives me a lot of time to learn !
@soco5338
@soco5338 5 ай бұрын
Good tutorial. This does exactly what I needed and it's really easy to integrate into my object pooling. I had two issues that I had to correct though that weren't any fault of OP, just the way my game is already set up. The first was easy, if your arrow has a rigidbody on it, you might need to set it to static or kinematic. The second issue was a bit more strange, but you need to make sure that the projectile is facing right when it's at rotation 0,0,0. Mine isn't, so I needed to subtract 90 degree from the z-axis in the UpdateRotation method. private void UpdateProjectileRotation() { Vector3 projectileMoveDir = projectile.GetProjectileMoveDir(); float angle = Mathf.Atan2(projectileMoveDir.y, projectileMoveDir.x) * Mathf.Rad2Deg; angle -= 90; // Adjust based on your arrow's initial orientation projectileVisual.transform.rotation = Quaternion.Euler(0, 0, angle); }
@Magma-uw7yo
@Magma-uw7yo 5 ай бұрын
5:53,: I have no Ideas why but my arrow go at the speed of light, I need to decrease the speed. My code is correct : Projectile : private Transform target; private float moveSpeed; private float distanceToDestroy = 1f; private void Update() { Vector3 moveDirection = (target.position - transform.position).normalized; transform.position += moveDirection * moveSpeed; if(Vector3.Distance(transform.position, target.position) < distanceToDestroy) Destroy(gameObject); } public void Shoot(Transform target, float moveSpeed){ this.target = target; this.moveSpeed = moveSpeed; }
@UnPawsGames
@UnPawsGames 5 ай бұрын
Dont't forget to *Time.deltatime your transform.position 😉
@Magma-uw7yo
@Magma-uw7yo 5 ай бұрын
@@UnPawsGames still have the same problem, now it's in fixed position
Can You Beat Minecraft From One Grass Block?
35:27
Beppo
Рет қаралды 6 МЛН
EASY Stats and Modifiers in Unity | Broker Chain Pattern
16:05
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
6 more days on my Automation x Dungeon Crawler Game ! Devlog
21:59
UnPaws Games
Рет қаралды 10 М.
134 Unity Components EXPLAINED in Less than 30 Minutes
24:01
This is GameDev
Рет қаралды 77 М.
Starting Solo Dev On My FIRST Game!
7:43
JakeDev
Рет қаралды 5 М.
2D Bullet / Projectiles in Unity / 2023
6:33
Distorted Pixel Studios
Рет қаралды 59 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,7 МЛН
Fire PROJECTILES in UNITY
11:17
BMo
Рет қаралды 29 М.
Can I 100% Superliminal and Get a Refund?
23:36
Gronf
Рет қаралды 334 М.
A simple procedural animation technique
8:31
argonaut
Рет қаралды 546 М.
What size should your assets be? | HD 2D GAME ART
12:10
Nonsensical 2D
Рет қаралды 154 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН