Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
2
Question by grybas · Apr 18, 2015 at 08:50 PM · texturespritespritescombinecombining

Combining multiple sprites

I am making a game where there are a lot of blood sprites, dead bodies. Each bullet hit instantiates new blood sprite object and eventually game starts to lag. How can i combine all these blood, dead bodies sprites into one big sprite or texture? I would like effect like in Crimsonland, where u can have infinite amount of blood sprites, dead bodies.

alt text

toforum.jpg (108.5 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

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by LMan · Apr 18, 2015 at 09:04 PM

I would suggest an object pool pattern.

Basically, keep a large number of sprites already instantiated in the level, but deactivated. Rather than instantiate a new object (which you might be finding expensive), simply reposition and activate an object from the pool. You can then fade the opacity over time, deactivate, and put the object back in the pool after it's no longer needed.

As far as combining the sprites, you'll want to look at batching

if you use an image editing program, (ie. Gimp, Photoshop, perhaps even MS Paint.) You can put all the sprites on the same texture file. This will cause many of the draw calls to anything on that one texture file to "Batch." Which will save you processing power.

Comment
Add comment · 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
1

Answer by nasa8 · Mar 15, 2016 at 01:38 PM

This is quite challenging task I suppose. I think of two options:

1) You can combine all the spilt blood into one sprite

2) Combine blood into one texture for multitextured (may be triplanar) terrain or something

The first way is easier to implement I think. If I were in your shoes I would try to combine all small sprites into bigger one changing it's texture dynamically by SetPixels method. Read texture of a small blood sprite by GetPixels, then calculate the offset for your big sprite and put there your change using SetPixels.

You can find the description of Set/GetPixels in Unity Scripting Manual.

Comment
Add comment · 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
0

Answer by DanBarreno · May 10, 2019 at 07:13 AM

I mentioned this post here

Comment
Add comment · 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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Difference between Sprite and Default texture types? 0 Answers

Sprite Editor Problems 2 Answers

Are shaders more efficient than manual pixel replacement? 0 Answers

Compine 4 sprites into one big image 0 Answers

Assigning UV Map to model at runtime 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