• 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 lampshade · Jun 28, 2010 at 12:44 AM · particlescolor

Change color of Particles

Hi,

I am wondering why the below code is not changing the color of my particles:

public GameObject instRegularParticles ; public Color [] holder ; void OnParticleCollision (GameObject other) { Debug.Log("Particles Collided"); // happens

 holder = new Color[5];
 holder = instRegularParticles.GetComponent<ParticleAnimator>( ).colorAnimation;

// change the initial value of 255,255,255,255 to redish? holder[0].r = 155f; holder[0].g = 41f; holder[0].b = 48f; holder[0].a = 214f; // coppy?
instRegularParticles.GetComponent<ParticleAnimator>( ).colorAnimation = holder; }

This logic worked when I wanted to decrement (fade particles away), I am asking what I could be doing wrong? Or not using, rather?

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 Eric5h5 · Jun 28, 2010 at 12:57 AM

Color values are 0 through 1, not 0 through 255.

Comment
Add comment · Show 2 · 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 lampshade · Jun 28, 2010 at 01:13 AM 0
Share

LOL! But how would I achieve a specific shade of "red"?

avatar image Tetrad · Jun 28, 2010 at 01:28 AM 0
Share

You can put in decimal values, i.e. .5f.

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Changing color of Particles C# 1 Answer

Why Particle Animator Color Animation Do not Applied to Game Object? 1 Answer

Change color of individual particles 1 Answer

How to change the color of Particle System? 3 Answers

How to change the alpha of a spawned particle? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges