Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Soilyman · Jan 11, 2018 at 02:08 PM · texturespriteparticle systememissionframes

Particle System Texture Sheet Animation - One of each Frame?

I don't know if this is possible or not; I've been messing with the particle system properties for a while and can't get it to perform how I'd like.

I have a texture sheet containing 3 rows of 4 sprites. The particle system is set to fire 1 burst of 4 sprites. I'd like the particle system to select a random row from the texture sheet and spawn exactly one of each sprite in that row for the burst emission. Sadly, the property for Start Frame only lets me pick a random sprite within constraints, so I can't guarantee that the same sprite will be duplicated within a burst.

I'm not massively familiar with scripting particle systems, but if this is a viable solution I'll gladly attempt to implement it.

alt textalt text

untitled-1.jpg (114.0 kB)
playership2-blue-debris.png (310.3 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by ifurkend · Jan 11, 2018 at 05:03 PM

You should rotate your sprite sheet texture by 90 degree, use 3 by 4 tile division and specify 1 row instead of random row. Finally duplicate this particle system 3 times with different sheet row. Unity should be able to batch the drawcalls of all 4 particle systems.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class nameYourScriptHere : MonoBehaviour {
     public ParticleSystem[] ps;
     float column;
     void OnEnable () {
         var tsam = ps[0].textureSheetAnimation;
         column = (float)(int)Random.Range(0, tsam.numTilesX - 1)/tsam.numTilesX;
         for (int i = 0; i < ps.Length; i++) {
             tsam = ps[i].textureSheetAnimation;
             tsam.frameOverTimeMultiplier = column;
         }
     }
 }
Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Soilyman · Jan 11, 2018 at 07:49 PM 0
Share

Thanks for the reply! I think this is heading closer to what I want, but I'm not sure it's quite perfect. I'd like each particle emission to emit 4 sprites of the same set/column. The idea is to have different shattering effects when a ship is destroyed.


I've made a quick image to show what I'm after; I want each particle burst to emit exactly one of each sprite within a single green column. The red boxes show an example of what the particle system could spawn using your method, if this makes more sense


alt text

avatar image ifurkend Soilyman · Jan 11, 2018 at 11:53 PM 0
Share

It does need a script (check my updated answer) for this occasion even though I feel that it's more productive to not handle it with particle system because you only want 4 particles emitted from the whole setup each time.

avatar image Soilyman ifurkend · Jan 13, 2018 at 01:41 PM 0
Share

Thank you, that's working exactly as I'd like now.

If you have a better method for this then I'm keen to learn and explore other avenues. But you've helped me out a lot so no worries if not, and thank you for your time :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

122 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Particle system does not re-emit until Start Lifetime elapsed 4 Answers

Bad quality of the sprite in Unity 0 Answers

Particle system, unaffected by attached sprite 1 Answer

Anti aliasing with sprites 0 Answers

compress photos on import 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges