Search Unity

[Solved]Particle System "Physics Module" is stripped - how to prevent without disabling stripping?

Discussion in 'Physics' started by bilalakil, Dec 27, 2019.

  1. bilalakil

    bilalakil

    Joined:
    Jan 28, 2018
    Posts:
    77
    When running my game on device, I see the following warning in the debug log:

    > The ParticleSystem uses a gravityModifier, but the Physics Module is stripped, so using a default value of 9.81m/sec/sec for gravity. Disable stripping in Player Settings to fix this.
    >
    > (Filename: ./Modules/ParticleSystem/Modules/InitialModule.cpp Line: 58)

    I've already a solution in place for preventing other Unity classes from being stripped (different types of colliders). However, I don't know what "Physics Module" this is referring to, so I don't know how to solve the problem.

    - I don't want to disable stripping - it's a good thing. I just want to prevent this specific module from being stripped, which I usually do by specifically interacting with it in a startup scene (as I've done to solve the other problems).
    - I don't see any Physics module on a Particle System.
    - I tried including a particle system with all modules enabled in the startup scene, but the "Physics Module" is still being stripped.
    - I searched this error online and didn't find anything useful.

    How can I prevent this from being stripped, so my gravity modifications can work fine?
     
  2. bilalakil

    bilalakil

    Joined:
    Jan 28, 2018
    Posts:
    77
    Turns out that although this is a 2D game, and 2D physics is used everywhere, it seemed to be referring to the 3D physics module that's being stripped.

    I tried adding a RB/3D collider to my loading scene prevent a theoretical 3D physics module from being stripped, and now we're good!

    Interesting that I needed to include the entire 3D physics module to solve this problem in a 2D game... Would be great if that wasn't necessary!
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,459
    FYI: I forwarded this post to the particle devs for you.
     
    richardkettlewell and bilalakil like this.
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Hey, yeah the gravity setting in the main particle settings uses the physics module, in case a non-default gravity force is being used (I.e not 9.81)

    In the package manager, in the built-in packages list, is the physics module enabled?

    And, perhaps more importantly, does 2d physics have its own gravity modifier?
     
    Last edited: Dec 28, 2019
  5. bilalakil

    bilalakil

    Joined:
    Jan 28, 2018
    Posts:
    77
    @richardkettlewell Thanks for checking in!

    The built-in physics and physics2D packages are enabled.

    Looks like 2D has its own: https://docs.unity3d.com/ScriptReference/Physics2D-gravity.html

    I suppose there's no way to tell the particle system which physics system to use? It's got a mix of 2D/3D settings - would be useful to be able to select the specific mode or have a separate component(s) with only the relevant settings visible.
     
  6. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Yeah you’re right. It’s an interesting problem - you really ought to be able to pick somehow. Right now a 2d system is still using the 3D system for gravity.

    I’ll add something to our roadmap to let you pick.

    Thanks!
     
  7. kyuskoj

    kyuskoj

    Joined:
    Aug 28, 2013
    Posts:
    56
    @richardkettlewell What should I add to link.xml to avoid this warning. I am on 2019.4

    edit: I found out.
    <type fullname="UnityEngine.Physics" preserve="all" />
     
    Last edited: Oct 4, 2020
    richardkettlewell likes this.
  8. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    390
    Hi @richardkettlewell, do you know if this was ever implemented?
     
  9. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Hey, no, unfortunately not. We stopped adding new stuff to the old particle system, in favour of committing resource to the Visual Effect Graph instead. But let me look at this again - something this small can still be doable.
     
  10. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    The ability to choose between 2D and 3D gravity will be added in Unity 2022.1.
    Thanks for the nudge on this!
     
    MelvMay likes this.
  11. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    390
  12. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Sorry, I don't think so - we don't generally backport new features, in order to reduce the risk of breaking stuff.
     
  13. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    390
    Understood, thanks for considering it.