• 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 pauliuso · Sep 25, 2015 at 12:29 PM · particle systemscaling

Is it possible to scale particle effect in Unity 5?

I saw quite a lot of similar questions but they are 3-4 years old, so is it possible to do it in Unity 5?

Here is a small part of my script:

 using UnityEngine;
 using System.Collections;
 
 public class Colisions : MonoBehaviour
 {
 
     public GameObject explosion1;
 
     private GameObject explosion;
 
 
     void OnTriggerEnter(Collider other) // If object which has this script collides with any other object
     {
 
         if(gameObject.tag == "Asteroid") // I'm setting different effects for different objects here
         {
             explosion = explosion1;
             /* I want to scale particle effect here pseudo - explosion.scale += 2 */
         }
 
         if (other.gameObject.tag == "Bolt") // If current object collides with bolt
         {
             gameObject.GetComponent<Soul>().damage(other.gameObject.GetComponent<Bullet>().devast, other.gameObject.GetComponent<Bullet>().type); // Each object has a 'Soul' class attached, it holds settings and health, it also has damage function which calculates damage, here I send damage and attack type from a Bolt object

             if (gameObject.GetComponent<Soul>().health <= 0) // If current object has no health
             {
                 Destroy(gameObject); // This object gets destroyed
                 Instantiate(explosion, transform.position, transform.rotation); // Here I add particle effect, but I want to scale it
             }
 
             Destroy(other.gameObject); // Bolt is also destroyed here
         }
 
     }
 }

Have a look at lines 18-19, there I want to scale a particle system, but I'm not sure if it's possible.

Also suggestions on how to improve this script are welcome too.

Comment
Add comment · Show 3
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 Cherno · Sep 25, 2015 at 01:04 PM 0
Share

Do you want to change the scale of the particles, or the scale of the emitter? For the former, change the ParticleSystem's Particle Starting Size. For the latter, scale the whole gameobject.

avatar image pauliuso · Sep 25, 2015 at 01:33 PM 0
Share

I want to change scale of the emitter, I want to be able to set scale of the particle effect from my script. And I can't just scale gameobject because particle effect doesn't belong to any game object, i just simply add particle effect like this:

 Instantiate(explosion, transform.position, transform.rotation);

I tried many things, like explosion.LocalScale, it doesn't work.

avatar image Cherno pauliuso · Sep 25, 2015 at 03:17 PM 0
Share

Okay... The GameObject you instantiate for the explosion: Does this GameObject have a ParticleSystem component?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Wolf_Tech · Sep 26, 2015 at 05:50 PM

Not 100% but heres how I would do it.

 GameObject particle = Instantiate(explosion, transform.position, transform.rotation) as GameObject;
 particle.transform.scale = new vector3 (x,y,z);

Thats how I would expect it to work, let me know how it goes.

Comment
Add comment · Show 1 · 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 pauliuso · Sep 26, 2015 at 06:02 PM 0
Share

This would work on ordinary objects. Still I tried it but no, doesn't work. Actually it's strange if unity doesn't support this, because even old game like warcraft III has support for scaling particle effects:]

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Make UI Particle System not scale 0 Answers

How do I adjust particle system values by holding the left mouse button? 0 Answers

Particle System Scaling - Not working for velocities 2 Answers

Random Non-uniform Particle Start Size? 1 Answer

Non-uniform scaling in Particle effects not working on Unity 2017 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