Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Feedback Legacy Particle System Updater

Discussion in 'Particle System Previews' started by richardkettlewell, Jan 2, 2018.

  1. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,619
    Lars-Steenhoff likes this.
  2. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,099
    Hmmm. It's a bit broken! I tried it on one effect, a water splash effect and it seems to make all the particles rotate in a funny manner. I've packaged up the before and after for you to see what's going wrong.
     

    Attached Files:

    richardkettlewell likes this.
  3. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    Hey. Thanks for the feedback. We have fixed some issues and updated to a new version 1.1 in the original post.

    https://imgur.com/ginGKye
     
    Last edited: Jan 4, 2018
    richardkettlewell likes this.
  4. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,099
    Ok Better, but something still wrong on this next one. in legacy the rune flies much higher in the sky. it's like something is wrong with scaling.

    *edit, it's your force over lifetime settings that seem wrong on this one.
    *edit, also something wrong with the number you put in emission cycles
     

    Attached Files:

    Last edited: Jan 5, 2018
    karl_jones likes this.
  5. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    Thanks I'll take a look
     
  6. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,619
    Feel free to submit suggestions for fixes :)
     
    karl_jones likes this.
  7. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,099
    I would but I never really understood what the values in the legacy system actually did so I’ve no idea what an equivalent value in which setting on the new system should be. If I did I wouldn’t need a converter.
     
  8. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,619
    Ok no worries :) Karl will figure it out I’m sure!

    We really appreciate you sending us these assets, thanks!
     
    karl_jones likes this.
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    Hey.

    Ok v 1.2 has lots of improvements.
    Thanks for the feedback so far.


    heal.gif
     

    Attached Files:

  10. Ericroy

    Ericroy

    Joined:
    Oct 9, 2010
    Posts:
    11
    Am I doing something wrong? With Unity 2017.1.0p4, if I put Legacy_Particle_System_Updater.cs 1.2 in the Editor folder, Assets/Upgrade Legacy Particles does not appear in the Menu and the console lists the following errors:

    Assets/Editor/Legacy_Particle_System_Updater.cs(155,73): error CS0117: `UnityEngine.AnimationCurve' does not contain a definition for `Constant'

    Assets/Editor/Legacy_Particle_System_Updater.cs(178,73): error CS0117: `UnityEngine.AnimationCurve' does not contain a definition for `Constant'

    Assets/Editor/Legacy_Particle_System_Updater.cs(178,107): error CS0117: `UnityEngine.AnimationCurve' does not contain a definition for `Constant'

    Assets/Editor/Legacy_Particle_System_Updater.cs(326,22): error CS0200: Property or indexer `UnityEngine.ParticleSystem.EmissionModule.burstCount' cannot be assigned to (it is read-only)

    Assets/Editor/Legacy_Particle_System_Updater.cs(331,19): error CS1061: Type `UnityEngine.ParticleSystem.Burst' does not contain a definition for `count' and no extension method `count' of type `UnityEngine.ParticleSystem.Burst' could be found. Are you missing an assembly reference?

    Assets/Editor/Legacy_Particle_System_Updater.cs(332,22): error CS1061: Type `UnityEngine.ParticleSystem.EmissionModule' does not contain a definition for `SetBurst' and no extension method `SetBurst' of type `UnityEngine.ParticleSystem.EmissionModule' could be found. Are you missing an assembly reference?

    Assets/Editor/Legacy_Particle_System_Updater.cs(478,35): error CS0103: The name `ParticleSystemStopAction' does not exist in the current context

    Assets/Editor/Legacy_Particle_System_Updater.cs(478,22): error CS1061: Type `UnityEngine.ParticleSystem.MainModule' does not contain a definition for `stopAction' and no extension method `stopAction' of type `UnityEngine.ParticleSystem.MainModule' could be found. Are you missing an assembly reference?
     
  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    The script was written in 2017.3. Ill take a look at 2017.1. it probably just needs a few tweaks.
     
  12. Ericroy

    Ericroy

    Joined:
    Oct 9, 2010
    Posts:
    11
    Thank you for the quick response. I updated to 2017.3 and the Legacy_Particle_System_Updater appears in the menu and seems to work. I won't know for sure until I tweak all of my scripts, which is not as straight forward as I would like.
     
    karl_jones likes this.
  13. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    435
    If you have some tweaks for 2017.1 that would be great, otherwise I just used this in a project I converted to 2017.4.1 and it seems to work great so far. Good work on this, it literally saved me a ton of hours of time that is better spent on other things!
     
    karl_jones and richardkettlewell like this.
  14. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    I
    I'll take a look on Monday for you. Glad to hear it works in 2017.4
     
    richardkettlewell likes this.
  15. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    435
    Thanks looking forward to it!
     
  16. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
  17. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    435
    karl_jones likes this.
  18. playemgames

    playemgames

    Joined:
    Apr 30, 2009
    Posts:
    435
    richardkettlewell and karl_jones like this.
  19. nightshadow

    nightshadow

    Joined:
    May 26, 2013
    Posts:
    5
    must be doing something wrong am using it is not showing up under the assets menu drop down I am using 2018.1.0f2
     
  20. JuJuCoder

    JuJuCoder

    Joined:
    Dec 10, 2013
    Posts:
    30
    I have the same issue in Unity 2018, It shows up in unity 2017 but I cannot get the 1.3 script to work there either.
     
  21. ax0079

    ax0079

    Joined:
    Jul 3, 2015
    Posts:
    7
    seems the updater only work on 2018.2 , but if I switch to 2018.2. it will have errors from legacy particle system code. So the updater will not show up in asset menu. I still don't understand how can I update the legacy code with the updater.
     
  22. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    The updater does not update scripts, just the component settings. If you post the code here we can take a look and advise you on how to update it.
     
    richardkettlewell likes this.
  23. ax0079

    ax0079

    Joined:
    Jul 3, 2015
    Posts:
    7
  24. Gasimo

    Gasimo

    Joined:
    Mar 3, 2015
    Posts:
    15
    So is there some Migration Manual for updating legacy scripts?
     
  25. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    Hi.
    No, we don't have an auto-update for scripts. The scripts are not a simple 1 to 1 mapping and so our script update system is not able to handle it.
    We have been looking at some of the common asset store packages and will either update them ourselves or assist the owners with updating.
    Detonator is one we have been working on, we used it to test our update script during development,
    We don't have a migration manual for updating scripts but it's a good idea so ill make a note into putting something together for this.
     
    richardkettlewell likes this.
  26. game_apps

    game_apps

    Joined:
    Mar 3, 2016
    Posts:
    36
    Hi,

    Upgraded my project from Unity 2017.4.0 to Unity 2018.1 , Project has Errors(not warnings) with the following partcicle api's:

    particleEmitter.emit = false ;
    particleEmitter.ClearParticles();
    particleEmitter.particles;
    particleEmitter.useWorldSpace;
    particleEmitter.energy;

    These api's dont exist now ? Can anyone guide me updating my script with new api's please? May be @karl_jones ?
     
    Last edited: May 15, 2018
  27. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    Hi. If you have an old effect using legacy then first upgrade the effect with the tools in this thread.
    Then to map over your script you should do this:

    Use Stop with the Stop and Clear behavior flag.

    Try GetParticles and SetParticles.

    You can set world space through the simulation space property.

    This is the start lifetime
     
  28. game_apps

    game_apps

    Joined:
    Mar 3, 2016
    Posts:
    36
    Thank you so much @karl_jones Gonna try now and paste here in case of further queries, appreciated the help :)
     
    karl_jones likes this.
  29. game_apps

    game_apps

    Joined:
    Mar 3, 2016
    Posts:
    36
    Some more :
    particleAnimator.autodestruct
    particleEmmiter. particleCount
    particleEmmiter.maxEnergy
     
    Last edited: May 15, 2018
  30. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
  31. game_apps

    game_apps

    Joined:
    Mar 3, 2016
    Posts:
    36
    Thanks.
    Ah we missed "particleEmmiter.maxEnergy" & particleEmmiter.Emit(int count); :) Thats the last one used in my project :)
     
    Last edited: May 15, 2018
  32. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
  33. ChristianLinnell

    ChristianLinnell

    Joined:
    Jan 7, 2013
    Posts:
    15
    Is this meant to work in 2018.1? It doesn't show up in the Asset menu, presumably because of all the compile errors I get from my legacy particle system code.

    I'm also trying to update Detonator… it would be handy if you guys could post the asset, if you've already managed to update it!
     
  34. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    If you look at our upgrader script you can see we map the maxEmission to either the burst(when using one shot mode) or the rate over time.

    Code (CSharp):
    1.         if (serializedObject.FindProperty("m_OneShot").boolValue)
    2.         {
    3.             main.loop = false;
    4.             emission.rateOverTime = 0;
    5.  
    6. #if UNITY_2017_2_OR_NEWER
    7.             emission.burstCount = 1;
    8. #endif
    9.  
    10.             ParticleSystem.Burst burst = new ParticleSystem.Burst();
    11.             burst.cycleCount = 1;
    12.             burst.cycleCount = int.MaxValue;
    13.             burst.repeatInterval = main.startLifetime.constantMax;
    14.  
    15. #if UNITY_2017_2_OR_NEWER
    16.             burst.count = ConvertToMinMaxCurve(minEmission, maxEmission);
    17.             emission.SetBurst(0, burst);
    18. #else
    19.             burst.maxCount = (short)maxEmission;
    20.             burst.minCount = (short)minEmission;
    21.             emission.SetBursts(new[] { burst });
    22. #endif
    23.         }
    24.         else
    25.         {
    26.             emission.rateOverTime = ConvertToMinMaxCurve(minEmission, maxEmission);
    27.         }
     
  35. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    I wasn't expecting you to use the code. It's copied straight out of the upgrader script. If you are using one shot mode then add it as a burst else just use the rate over time property. The code was to give you an idea of how to do it.

    The scripting docs show how to change the rate over time https://docs.unity3d.com/ScriptReference/ParticleSystem.EmissionModule-rateOverTime.html

    So you would do something like this

    Code (CSharp):
    1.  
    2. ===========================
    3. var partSystem = rainParticles.GetComponent<ParticleSystem>();
    4. var emission = partSystem.emission;
    5. emission.rateOverTime = 0;
    6. ===========================
    7. var emission = partSystem.emission;
    8. if (emission.rateOverTime  < rainAmmount)
    9. {
    10.     emission.rateOverTime = += Time.deltaTime * 20;
    11. }
    12. ==============================
    13.  
     
    richardkettlewell likes this.
  36. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    RateoverTime is a minmaxcurve so you need to do get the scalar value.

    emission.rateOverTime.scalar

    emission.rateOverTime = emission.rateOverTime.scalar + Time.deltaTime * 20;
     
  37. ev3d

    ev3d

    Joined:
    Apr 19, 2013
    Posts:
    327
    Why does it say I have to have unity 2018.2? 2018.2 isn't even released yet? I'm a bit confused since conversations talk about it working in 2017
     
  38. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    It did work in 2017 however some functionality was missing which we needed to add in 2018. You can use it in 2017, just comment out the missing api
     
  39. fsyoung11

    fsyoung11

    Joined:
    May 31, 2017
    Posts:
    2
    Does the new script update for 2018.2?
     
  40. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    No. It won't ever work after 2018.1 because it requires the legacy particles to still exist in Unity in order to perform the upgrade. Use 2018.1 to upgrade and then move to you preferred version with the upgraded system.
     
    fsyoung11 likes this.
  41. Abdul007

    Abdul007

    Joined:
    Mar 13, 2018
    Posts:
    3
    <ParticleEmitter>().Emit();
    I have this issue in unity 2018.1 that particle system not working and giving error with this

    Assets/RFPSP/Scripts/Objects/!Destructibles/BreakableObject.cs(50,20): error CS1061: Type `UnityEngine.ParticleEmitter' does not contain a definition for `Emit' and no extension method `Emit' of type `UnityEngine.ParticleEmitter' could be found. Are you missing an assembly reference?

    I upgraded unity project from 2017.1 to this 2018.1 and this particle system error occurred

    Assets/RFPSP/Scripts/Objects/!Destructibles/BreakableObject.cs(50,20): error CS1061: Type `UnityEngine.ParticleEmitter' does not contain a definition for `Emit' and no extension method `Emit' of type `UnityEngine.ParticleEmitter' could be found. Are you missing an assembly reference?
     
    Last edited by a moderator: Aug 8, 2018
  42. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    We have phased out the legacy particle system. The scripting API is gone in 2018.1. In 2018.2 we completely removed the legacy particle system. Try the updater tool to update any legacy particle system prefabs you have.
     
  43. Abdul007

    Abdul007

    Joined:
    Mar 13, 2018
    Posts:
    3
    Please, mention any updater tool.

    i m asking this because in my unity menu-> assets->run api updator is diabled i dont know why
     
    Last edited by a moderator: Aug 8, 2018
  44. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    At the top of this thread. Grab the script from https://forum.unity.com/threads/release-legacy-particle-system-updater.510879/

    I have a feeling you are going to be disappointed, it's not going to fix everything automatically like the script updator.
    This is the complete removal of an old feature. There is no identical 1 to 1 replacement. The shuriken particle system is more featured and can create the same effects however there is no simple conversion. We provide a tool(above) that will attempt to take a legacy system and create a similar effect using shuriken although in some cases it may not match exactly. We DO NOT do any script upgrading. Our script updator simply can not handle the type of upgrade required and the API for both systems is very different. We can offer advice on how to upgrade scripts if you hit issues, we recommend you look at the code for the tool we provide to get an idea on how the properties map across.
     
  45. Deleted User

    Deleted User

    Guest

    This doesn't look right. I'm guessing from the version notes that the #if was intended to be UNITY_2018_2_OR_NEWER and the message was intended to be "between 2017.2 and 18.2".

    Code (CSharp):
    1. #if UNITY_2017_2_OR_NEWER
    2.         helpString = @"This Script adds ParticleSystem and ParticleSystemRenderer Components to all GameObjects that contain Legacy Particle Components.
    3.        This script is not support in this version, please run this script using a Unity version between 2018.2 and 2018.2.";
    In any case, I just removed the #if and was able to run it successfully in Unity 2018.2.3 in a project where I still have legacy particle systems and the legacy particle package enabled in the Package Manager.
     

    Attached Files:

    karl_jones likes this.
  46. ViperTechnologies

    ViperTechnologies

    Joined:
    Apr 28, 2017
    Posts:
    35
    Thanks for the grate tool :)
    well it worked fair but i have such problems that i could not fix min are scripts ... i am trying to upgrade the scripts which are managing the particle system to be able to upgrade it to unity 2018.2 + here are the steps i took:
    1- upgraded the project from 2017.2 to 2017.4
    2- loaded the upgrade script selected my legacy ParticleEmitter prefab (GO) and hit upgrade selected (without filling any of the placeholders have no idea what they do "script " which is grayed out and persistent view data dictionary)
    3- recheck and disable all the components that are related the the legacy deprecated ParticleEmitter.

    in order to go for the project upgrade i have to change these as well :

    Code (CSharp):
    1.  
    2. _skidSmoke = _skidmarks.GetComponentInChildren<ParticleSystem>();
    3.  
    4.  
    5. //and
    6.  
    7. if(skidGroundSpeed > 0 || handbrakeSkidding > 0 || _isSlipping && !_trackManager.IsReplayPlaybackPaused())
    8.                         {
    9.                    
    10.                      
    11.                             // Calculate how many particles to emit as we are emitting manually
    12.                             Vector3 staticVel = _transform.TransformDirection(_skidSmoke.localVelocity) + _skidSmoke.worldVelocity;
    13.                             if(w.lastSkidmark != -1)
    14.                             {
    15.                                 float emission                         = UnityEngine.Random.Range(_skidSmoke.minEmission, _skidSmoke.maxEmission);
    16.                                 float lastParticleCount             = w.lastEmitTime * emission;
    17.                                 float currentParticleCount             = Time.time * emission;
    18.                                 int noOfParticles                      = Mathf.CeilToInt(currentParticleCount) - Mathf.CeilToInt(lastParticleCount);
    19.                                 int lastParticle                      = Mathf.CeilToInt(lastParticleCount);
    20.  
    21.  
    22.  
    23.                                 for(var i = 0; i < noOfParticles; i++)
    24.                                 {
    25.                                     float particleTime = Mathf.InverseLerp(lastParticleCount, currentParticleCount, lastParticle + i);
    26.                                     _skidSmoke.Emit(
    27.                                         Vector3.Lerp(w.lastEmitPosition, wh.point, particleTime) + new Vector3(Random.Range(-0.1f, 0.1f),     Random.Range(-0.1f, 0.1f),Random.Range(-0.1f, 0.1f)),
    28.                                         staticVel + (w.wheelVelo * 0.05f),
    29.                                         Random.Range(_skidSmoke.minSize, _skidSmoke.maxSize),
    30.                                         Random.Range(_skidSmoke.minEnergy, _skidSmoke.maxEnergy),
    31.                                         Color.white);
    32.                                 }
    33.                             }
    34.                             else
    35.                             if (_nextParticleTimer>_skidSmokePerSecond)
    36.                             {
    37.                                 _nextParticleTimer -= _skidSmokePerSecond;
    38.                                 _skidSmoke.Emit
    39.                                 (
    40.                                     wh.point + new Vector3(Random.Range(-0.1f, 0.1f), Random.Range(-0.1f, 0.1f), Random.Range(-0.1f, 0.1f)),
    41.                                     staticVel + (w.wheelVelo * 0.05f),
    42.                                     Random.Range(_skidSmoke.minSize, _skidSmoke.maxSize) ,
    43.                                     Random.Range(_skidSmoke.minEnergy, _skidSmoke.maxEnergy),
    44.                                     Color.white
    45.                                 );
    46.                             }
    as well as this one :

    any ideas how can i upgrade these so i can go for the 2018.2 and up ?
    Thank you so much.
     

    Attached Files:

    Last edited: Sep 8, 2018
  47. ViperTechnologies

    ViperTechnologies

    Joined:
    Apr 28, 2017
    Posts:
    35
    sorry i forgot to put this one as well :
    Code (CSharp):
    1.  
    2.     #pragma warning disable 0618
    3.     private ParticleEmitter[] SplashEmitters;
    4.     #pragma warning restore 0618
    5.     // Use this for initialization
    6.     void Awake ()
    7.     {
    8.         // Cache the transform
    9.         MyTransform = transform;
    10.  
    11.  
    12.  
    13.  
    14.                 for ( int i = 0; i < SplashEmitters.Length; i++ )
    15.                 {
    16.                     SplashEmitters[ i ].emit=false;
    17.                 }
    18.        
    19.      
    20.  
    21.  
    22.          
    23.  
    24.  
    25.                     for ( int p = 0; p < SplashEmitters.Length; p++ )
    26.                     {
    27.                         SplashEmitters[ p ].Emit() ;
    28.                     }
    29.              
    30.                 }
    31.             }
    32.         }
    33.     }
    34.  
    35.  
    36.  
    37. }
    38.  
     
    Last edited: Sep 11, 2018
  48. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,176
    Here are some of the upgrade parts. You will need to slot them into your code.

    Code (CSharp):
    1.         var _skidSmoke = GetComponentInChildren<ParticleSystem>();
    2.  
    3.         // Vector3 staticVel = _transform.TransformDirection(_skidSmoke.localVelocity) + _skidSmoke.worldVelocity;
    4.         var velOverLifetime = _skidSmoke.velocityOverLifetime;
    5.         Vector3 staticVel = new Vector3(velOverLifetime.x.Evaluate(0), velOverLifetime.y.Evaluate(0), velOverLifetime.z.Evaluate(0));
    6.  
    7.         // float emission = UnityEngine.Random.Range(_skidSmoke.minEmission, _skidSmoke.maxEmission);
    8.         var emit = _skidSmoke.emission;
    9.         float emission = emit.rateOverTime.Evaluate(0);
    10.  
    11.  
    12.         var emitParams = new ParticleSystem.EmitParams(); // Put the various values into this
    13.         _skidSmoke.Emit(emitParams, emission);
    14.  
    15.  
    16.         // Random.Range(_skidSmoke.minSize, _skidSmoke.maxSize)
    17.         var main = _skidSmoke.main;
    18.         var size = main.startSize.Evaluate(0);
    19.  
    20.         //Random.Range(_skidSmoke.minEnergy, _skidSmoke.maxEnergy),
    21.         var energy = main.startLifetime.Evaluate(0);
     
    ViperTechnologies likes this.
  49. ViperTechnologies

    ViperTechnologies

    Joined:
    Apr 28, 2017
    Posts:
    35
    Hi @karl_jones
    you are awesome !
    thanks for this i will give a go to this new ones you sent
    am so grateful thanks.
     
    richardkettlewell and karl_jones like this.
  50. ViperTechnologies

    ViperTechnologies

    Joined:
    Apr 28, 2017
    Posts:
    35
    @karl_jones

    ok now my code is look like this :

    Code (CSharp):
    1.                         if(skidGroundSpeed > 0 || handbrakeSkidding > 0 || _isSlipping && !_trackManager.IsReplayPlaybackPaused())
    2.                         {
    3.  
    4.  
    5.                             // Calculate how many particles to emit as we are emitting manually
    6.                             var velOverLifetime = _skidSmoke.velocityOverLifetime;
    7.                             var emit = _skidSmoke.emission;
    8.                             float emission = emit.rateOverTime.Evaluate(0);
    9.                             var emitParams = new ParticleSystem.EmitParams();
    10.                             var main = _skidSmoke.main;
    11.                             var size = main.startSize.Evaluate(0);
    12.                             var energy = main.startLifetime.Evaluate(0);
    13.                             Vector3 staticVel = new Vector3(velOverLifetime.x.Evaluate(0), velOverLifetime.y.Evaluate(0), velOverLifetime.z.Evaluate(0));
    14.                             if (w.lastSkidmark != -1)
    15.                             {
    16.  
    17.                                 float lastParticleCount             = w.lastEmitTime * emission;
    18.                                 float currentParticleCount             = Time.time * emission;
    19.                                 int noOfParticles                      = Mathf.CeilToInt(currentParticleCount) - Mathf.CeilToInt(lastParticleCount);
    20.                                 int lastParticle                      = Mathf.CeilToInt(lastParticleCount);
    21.  
    22.  
    23.  
    24.                                 for (var i = 0; i < noOfParticles; i++)
    25.                                 {
    26.                                
    27.                                     float particleTime = Mathf.InverseLerp(lastParticleCount, currentParticleCount, lastParticle + i);
    28.                                     _skidSmoke.Emit(
    29.                                         Vector3.Lerp(w.lastEmitPosition, wh.point, particleTime) + new Vector3(Random.Range(-0.1f, 0.1f),     Random.Range(-0.1f, 0.1f),Random.Range(-0.1f, 0.1f)),
    30.                                         staticVel + (w.wheelVelo * 0.05f),
    31.                                         size,
    32.                                         energy,
    33.                                         Color.white);
    34.                                 }
    35.                             }
    36.                             else
    37.                             if (_nextParticleTimer>_skidSmokePerSecond)
    38.                             {
    39.                                 _nextParticleTimer -= _skidSmokePerSecond;
    40.                                 _skidSmoke.Emit
    41.                                 (
    42.                                     wh.point + new Vector3(Random.Range(-0.1f, 0.1f), Random.Range(-0.1f, 0.1f), Random.Range(-0.1f, 0.1f)),
    43.                                     staticVel + (w.wheelVelo * 0.05f),
    44.                                      size,
    45.                                      energy,
    46.                                     Color.white
    47.                                 );
    48.                             }
    49.                    
    50.                             w.lastEmitPosition = wh.point;
    51.                             w.lastEmitTime = Time.time;
    52.                        
    53.                             // Add the skidmark to the skidmark mesh
    54.                             w.lastSkidmark = _skidmarks.AddSkidMark(wh.point + _rigidBody.velocity * dt, wh.normal, (skidGroundSpeed * 0.1f + handbrakeSkidding) * Mathf.Clamp01(wh.force / wheel.suspensionSpring.spring), w.lastSkidmark);
    55.                        
    56.                             // Play the skid sound if not already playing
    57.                             if (_soundController!=null)
    58.                                 _soundController.Skid(true, 1.0f);
    59.                         }
    but i have some problems with it :

    Car.cs(2168,48): warning CS0618: `UnityEngine.ParticleSystem.Emit(UnityEngine.Vector3, UnityEngine.Vector3, float, float, UnityEngine.Color32)' is obsolete: `Emit with specific parameters is deprecated. Pass a ParticleSystem.EmitParams parameter instead, which allows you to override some/all of the emission properties'

    Car Physics System/Car.cs(2149,33): warning CS0219: The variable `emitParams' is assigned but its value is never used


    and i am having heavy lag spikes ! (i am testing it in unity2017.4.8 and after this process went successful am gonna port it to unity2018.2.x)
    am sure am am missing something...i would be grateful of a hint or correction.
    i tried to assign emitParams, emission, as you mentioned but it gives me overload +3 :
    Code (CSharp):
    1.                             {
    2.                                 _nextParticleTimer -= _skidSmokePerSecond;
    3.                                 _skidSmoke.Emit
    4.                                 (emitParams, emission,
    5.                                     wh.point + new Vector3(Random.Range(-0.1f, 0.1f), Random.Range(-0.1f, 0.1f), Random.Range(-0.1f, 0.1f)),
    6.                                     staticVel + (w.wheelVelo * 0.05f),
    7.                                      size,
    8.                                      energy,
    9.                                     Color.white
    10.                                 );
    11.                             }
    error CS1501: No overload for method `Emit' takes `7' arguments
     
unityunity