0

I started this project while taking a course on Udemy. In the course, the instructor has you in Unity 4.6 and then later in unity 5.x. I have taken what was done in the course and made changes and expanded on the game as a learning experience. My first step was to upgrade the whole thing to the version of Unity (5.5). In the course, the code below simply set the startColor of the particle system. I wanted the start color to be the same color as the SpriteRender. I have the following code:

void Puff(){
    GameObject smokePuff = Instantiate(smoke, transform.position, Quaternion.identity)as GameObject;
    smokePuff.GetComponent<ParticleSystem>().startColor = gameObject.GetComponent<SpriteRenderer>().color;

So now I get the warning:

Warning CS0618 'ParticleSystem.startColor' is obsolete: 'startColor property is deprecated. Use main.startColor instead.'

I tried several things and cannot seem to get rid of this warning.

The closest answer I have been able to find is at:

https://docs.unity3d.com/ScriptReference/ParticleSystem.MainModule-startColor.html

However, this article shows changing the color directly and I want to set the color to be the same color as the SpriteRender.

Question: The code actually does work in spite of the warning. It is the only warning I get as I have already addressed all the other changes in my game to get things in line with Unity 5.5. Should I just ignore the warning?

If ignoring the warning is a no-no then I am stumped. Any suggestions would be appreciated.

  • Programmer, if you are going to mark my question as an exact duplicate could you please at least show where the duplicate is located? I find it hard to believe that another question is completely identical my question. –  Mar 26 '17 at 11:40
  • I have a question about the so-called duplicate question concept. If my question is in fact NOT an exact duplicate but only very similar to someone's question in the past, why is that similarity such an awful thing? what is the harm in having a question asked that it similar to some past question? It really bugs me when I see the this sort of thing on this site. Especially, when a lot of the times the question is not adequately answered. Asking the question again brings it new attention and perhaps better answers are provided. What is the harm in that?! –  Mar 26 '17 at 11:56

0 Answers0