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
0
Question by Nerethar · Jul 15, 2013 at 10:26 AM · c#meshparticlesystem

How to change the mesh of a particle system at runtime C#

Hi guys,

I would like to change the mesh of a particle system at runtime, but I have no clue how I get the "Renderer"-part of the Particle System Component.

Does anyone here has experience with this or knows the answer?

Thanks for any help =)

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by CHPedersen · Jul 15, 2013 at 10:54 AM

There is no single instance of the Mesh class for a particle system. Rather, it is a collection of meshes where each particle is a 2-triangle plane that is essentially a textured billboard. You can't access these in the same sense you access the .mesh property of a MeshFilter component.

But, depending on what you want to do with it, you have some options. MonoBehavior exposes a property called particleEmitter that allows you to access the ParticleEmitter component. It in turn exposes an array which contains instances of the Particle class. These contain the data you would typically associate with a single particle, such as its velocity, color, position, etc. You may then change these properties as you see fit, and assign the changed array of particles back to the emitter when done, like so:

     Particle[] particles = particleEmitter.particles;
     particles[0].position = new Vector3(0, 0, 0);
     particleEmitter.particles = particles;

This is somewhat akin to how you would modify the individual vertices of a Mesh and then assign the changed vertex array back to the mesh to see your changes take effect. Have a look at the particleEmitter (and, possibly, the particleSystem) property in scripts, and see if they satisfy your needs. If you use an editor that doesn't offer code completion (Intellisense), you can see the available properties of class ParticleEmitter here:

http://docs.unity3d.com/Documentation/ScriptReference/ParticleEmitter.html

And class Particle here:

http://docs.unity3d.com/Documentation/ScriptReference/Particle.html

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 NathanJSmith · Oct 23, 2018 at 04:19 AM

You can access the mesh of Particle Fx via ParticleSystemRenderer.mesh

For example:

 GetComponent<ParticleSystemRenderer>().mesh = 
 Resources.GetBuiltinResource("Capsule.fbx");

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

17 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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How do I Force Particle System within an area and hide certain ones through arrays? 0 Answers

How to Move two spheres over the surface of irregular shapes meshes towards the closest X and Y boundary of mesh without leaving its trigger till end.,? 0 Answers

I need your help with this system of particles, good with this code 1 Answer


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