Multiple Sprites With One Particle System (Unity Tutorial)
Vložit
- čas přidán 22. 08. 2024
- In this Unity tutorial I show you how to use multiple single sprites with the particle system. We use a texture atlas, cut our sprites using the Sprite Editor. Then use the Texture Sheet Animation component on the particle effect to allow multiple sprites to be used and emitted from the particle system.
🎁 Get OVER 225+ scripts & projects on my PATREON:
➡️Main Link: bit.ly/SpeedTut...
➡️Full List: tinyurl.com/ST...
·························································································
➡️(My Game) Left Alone on Steam: tinyurl.com/Lef...
🔥SpeedTutor Unity Store: bit.ly/STUnity...
🔥 INSANE UNITY SAVINGS: bit.ly/UnitySa...
🕹️Unity Sales: bit.ly/UnitySa...
🕹️Quick-Start Bundle: bit.ly/UnityQu...
🕹️Weekly Publisher Sale (+FREE Asset): bit.ly/WeeklyP...
🕹️Unity New Release Discount Sale: prf.hn/l/BdvEmg3
🔥 INSANE UNITY SAVINGS: bit.ly/UnitySa...
🕹️Unity Sales: bit.ly/UnitySa...
🕹️Quick-Start Bundle: bit.ly/UnityQu...
🕹️Weekly Publisher Sale (+FREE Asset): bit.ly/WeeklyP...
🕹️Unity New Release Discount Sale: prf.hn/l/BdvEmg3
🔥 INSANE HUMBLE SAVINGS: bit.ly/HumbleB...
🕹️*NEW* Unity Prototype Asset Bundle: bit.ly/UnityPr...
🕹️*NEW* Unity Environment Massive Bundle: tinyurl.com/Un...
🕹️Synty Humble Bundle: tinyurl.com/Sy...
🕹️Unreal Environment Mega Bundle: tinyurl.com/38b...
🔥 FANATICAL GAMEDEV BUNDLES: fas.st/t/HYxySc2q
🕹️Fanatical Bundle Savings (+20% OFF): bit.ly/Fanatic...
🕹️TopDown RPG 2D Assets Bundle: tinyurl.com/Top...
🕹️Dark Worlds Music Bundle: tinyurl.com/Dar...
🕹️Game Design Assets Bundle: tinyurl.com/56x...
🔥Synty Discounts & Savings: bit.ly/SyntyLo...
🔥Unity Pro Deals: bit.ly/UnityPr...
🔥Topcashback: bit.ly/Topcash...
·························································································
💰BIG DISCOUNTS on my website, for my UNITY ASSETS:
➡️www.speed-tuto...
💬Join the Community Discord:
➡️ / discord
💝 Make a donation to the channel:
➡️www.paypal.me/s...
·························································································
⬇️ SpeedTutor Puzzle Assets:
🧩Unity Store: bit.ly/STUnity...
🧩My Website Discounts: www.speed-tuto...
⬇️ SpeedTutor Best Selling Assets:
🧩Adventure Puzzle Kit: bit.ly/STAdven...
🧩 Note & Letter System: bit.ly/STNoteL...
🧩Examine System: bit.ly/STExami...
🧩Keypad System: bit.ly/STKeypa...
⬇️SpeedTutor Model Packs:
🧩Unity Store: bit.ly/STUnity...
🧩My Website Discounts: www.speed-tuto...
My Assets include: Gas Mask, Flashlight, Generator, Themed Key , Padlock, Phone, Chess Puzzle, Lever, Valve Puzzle, Fuse Box & Safe Systems. Cardboard, Debris, Massive Models and more!
························································································
⭐ Connect with me:
💬| Discord: / discord
🐦| Twitter: / speedtutor
📱 | Facebook: / speedtutoruk
🖥 | Website: www.speed-tutor...
·······················································································
Let me sprinkle some particles on your life! A new thumbnail, what do you think? Need some OPINIONS! :D
🕹Unity New Year Sale (Exp: 11 Jan 22): bit.ly/UnityNewYear21Sale
🕹Check out all the Humble Bundle Deals: bit.ly/HumbleBundleDeals
🎁 Get OVER 115 Scripts, Projects on my PATREON HERE:
bit.ly/SpeedTutorPatreon
Was working on an Asteroids clone and wanted to have the asteroids explode into multiple types of chunks, this was exactly what I was looking for. Thanks!
You're very welcome! :D I'm glad it worked out for you.
Just what I need! I was struggling with my particle system and you save me so much time by explaining correctly the sprite function!
I'm really glad you found this helpful! :D
Great video and thanks for sharing! You can also slice by clicking Sprite editor - Slice - automatic or by cell size on the top left. Second button from left. With 4 picture it really isn't a time saver but when you have to do them hundreds of times, like I did in one project then it becomes really useful
That's a really good piece of advice! Do you have to make sure they'll all uniform distance apart?
Another great particle system tutorial for Unity, thanks man keep them coming!
I will do, thanks for watching my friend! :)
Thanks! Concise and easy to follow!
I'm really glad you found it useful, what are you creating? :D
thx much. it's a really important thing to be able to do and it is not explain well enough and nearly enough, so bravo. this was a great tutorial!
I really hope you found it useful :)
Exactly what i needed, I was stuck on the "all sprite on same atlsa". Thanks a lot. cool video :)
I'm really glad to hear it was helpful! :) Any tips for others, do let me know! :)
youtube recommended this to me and i learned something new. Thanks
Haha, thanks for coming to check this out! :D
how did I not know about this! this is great even if I only have 1 sprite
You're very welcome! What are you going to create? :o
@@SpeedTutor A game about eggs
Thanks!
I really appreciate that, my dude! I've never had one of these thanks before, haha. Good luck with your project all the same! :D
Thank you soo much
You're very welcome, what are you going to be making?
great video, very helpful. thank you :)
You're very welcome, Nubcake! :P
Amazing video! thank you!!
That's no problem at all, Bernard! Thanks for watching, my friend! :D
Thank you man
You're very welcome, my dude! :)
Great, thank you 😀
That's no problem at all, thanks for coming along to watch! :D
thank you!
You're very welcome! :)
And what about the material? does the material need have the same texture? or a material with a blank space on the albedo also works?
The Particle System was my friend all along, why it go to flicker my sprites
It never left your side :)
@@SpeedTutor 🤔 Any thoughts on why it flickers as a sprite sheet ?
I'm sorry I can't be more helpful, I'm not really sure about this one. Anything you can throw into Google?
@@SpeedTutordidn't find it on google but My lazy Sprite sheet was at fault, I got it. Thanks though, now to try adding it to Collison to add to my animations etc
Just wanted to comment on that glorious 60s radio... 😂
Haha, you can have it for Christmas! It's on the Unity store for FREE! :D
To be honest I do need one...more of the type they used on Gilligan's Island though
Hi! Is it possible for me to use different sprites (for animation) on particle. I wanna make bug flies using particle effect
You'd most likely want to use a sprite sheet for that but I do have a tutorial on creating flies! :)
Any idea why my sprites are showing up as purple? The sizes change accordingly but the texture doesnt
That sounds like a material / shader issue? Have you checked the material?
Thanks for the tutorial! Is there something that needs to be done with Renderer or the material in Renderer? I've set up my Texture Sheet Animation as you have here, but I'm still getting the default purple squares being emitted.
What pipeline are you using?
@@SpeedTutor Thanks for the response. I'm still pretty new to Unity, so whatever is the default. I haven't setup a specific pipeline. Regardless, I've already solved my issue via other means as I ultimately wanted to animate each particle through each sprite in the spritesheet, which I now have working. Thanks again!
Oh awesome, good job! :D Thanks for checking this out, needless to say. :)
any way to randomize 'Animated' sprites?
I'm not sure about that question, sorry I can't be more specific!
@@SpeedTutor thats fine I couldnt find any other way but to make a new particle system for each animated sprite and just embed them into a single prefab
Is there a way to burst all of the sprites by keeping their order same as the atlas? For example; I have a 3x3 sprite atlas and I wanna emit all 9 sprites at the same time and positioned as same as the atlas order from 1 to 9. This is to achieve a shatter effect.
That is a very good question and I'm really not sure about that one. Can you set the array in the atlas?
@@SpeedTutor I did but couldn't get the particle emitter to follow it. Texture Sheet Animation tab has the 'Random Between Two Constants' option but what I need is 'Integer Between To Constants' or 'Step Between Two Constants' or something. It would be tremendously useful to break objects.
@@aalperbayram Merhaba, bu sorunu çözebildiniz mi yoksa farklı particle systemları oluşturmak zorunda mı kaldınız? Benzer bir problem yaşıyorum da..
@@vainm Merhaba maalesef çözememiştim ve tekrar denemedim. Kodla çözülür gibi duruyor.
@@aalperbayram Kodla start frame'leriyle oynayarak yapmaya çalışıyorum çok uzun süredir fakat başarısızım. Tüm particle'ları aynı anda editliyor. Sanırım vazgeçeceğim. Teşekkürler cevabınız için.
I'm working on a mod for a game and I want the player to select one or more custom images for a particle system in the game. I can't use the Unity editor for this (everything needs to be done through code). Is it possible to do this all through code?
Maybe I can load the images and manually make a texture sheet out of it. Then I can maybe somehow cut the sprites in the texture sheet after I've done that. And then I need to figure out how to assign that to the particle system. Am I on the right track?
That's a really tough question but could you not create a large texture sheet with all the images that will be used in-game? Then once they're spliced, as long as you keep them equally spaced apart (In your texture sheet). You might be able to auto-slice them (You can within the sprite editor) and then they'll be accessible if you increment all the names based on how many I imagine you could have in an array or list. It's pure speculation by me and I'm sorry I can't be of more concrete help but it might be worth asking someone who has far more experience in it. I hope you work it out though! :)
@@SpeedTutor Thank you very much for your reply!
I want to user to be able to put their own images in a folder and then select the images they want to use so that they can easily change the selection in-game.
But I suppose I should first keep things simple and require a texture sheet if the user wants multiple images 😅
Thanks again 😊
@@SpeedTutor I found a solution😄 I forgot to come back to this after I solved it, but here's what I did:
The way I solved it is by using a Grid. This makes it a lot easier to implement. In fact, it turns it into just 12 lines of code.
// To load the spritesheet:
Texture2D myTexture = new Texture2D(2, 2);
byte[] textureData = File.ReadAllBytes(filePath); // filePath is a string with the full path to the spritesheet file.
ImageConversion.LoadImage(myTexture , textureData);
// To set the spritesheet:
Material material = myParticleSystem.gameObject.GetComponent()?.material;
material.mainTexture = myTexture;
// To configure the AnimationModule:
TextureSheetAnimationModule texSheetAnimation = myParticleSystem.textureSheetAnimation;
texSheetAnimation.enabled = true;
texSheetAnimation.mode = ParticleSystemAnimationMode.Grid;
texSheetAnimation.numTilesX = settings.imgCountX;
texSheetAnimation.numTilesY = settings.imgCountY;
texSheetAnimation.timeMode = ParticleSystemAnimationTimeMode.Lifetime;
texSheetAnimation.startFrame = new MinMaxCurve(0, settings.imgCountX*settings.imgCountY);
why my particles are purple?
The material or shader might be an issue, you might need to look at that :)
Great Video :D
42 Likes its missing a 0 hehe :D
Haha, thanks very much! Maybe if you create 350 more accounts to like the video? :P
@@SpeedTutor hehe :D