Search Unity

Question ParticleSystem meshes must be read/write enabled to work

Discussion in 'General Graphics' started by Peter77, Jan 22, 2021.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    https://docs.unity3d.com/2018.4/Documentation/Manual/PartSysShapeModule.html

    What exactly means "If you assign them in the Editor, Unity handles this for you."? What handles the Editor?

    The Editor doesn't turn on "Read/Write Enabled" on the mesh Import Settings, I checked this. Or will the Editor enable "Read/Write Enabled" internally, but fail to do so when building a Player? I'm wondering if I must turn on "Read/Write Enabled" on all meshes that are used for ParticleSystems. :confused:
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,276
    When you build, the build system has a step where it checks various things and one of them is that all meshes that are referenced by a PS are marked as read/write. The flag wont be changed in the editor, its done in the background only when a build is occurring.
    So if a mesh is not referenced in an asset(prefab/scene etc) but you plan to do so in the player, maybe via a script, then we wont be able to fix it for you and so you will need to ensure that its marked as read/write

    You only need to turn it on off you are going to use a mesh in the player that is not part of a PS when the game is built. So generally if you are doing stuff with scripts.
    There is no harm in turning it on manually though.
     
    petchanliu, elechen and Peter77 like this.
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Thank you for the quick reply. Does this magic also work if the particle system is stored in an asset bundle?

    How does it look like when I change it at runtime to a mesh that doesn't use Read/Write Enabled? Will it just not render, render pink, crash?
     
    Last edited: Jan 22, 2021
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    Asset bundles work in some cases but not all. I think it’s something like, if the mesh is in a different bundle to the particle system then it won’t work.

    i think you get console spam if you assign one at runtime that isn’t read/write. Unity should never crash (famous last words)
     
  5. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,609
    Thank you for the quick help.

    In this case, I think we better just turn on Read/Write Enabled in the Mesh Importer for all meshes used in particle systems. Better safe than sorry ;)
     
    Last edited: Jan 22, 2021
  6. Tony_Max

    Tony_Max

    Joined:
    Feb 7, 2017
    Posts:
    351
    That is terrible design. I've spent hours trying come up with something wrong with PS itself. It looks like complete mess in build, when part of meshes with auto-enabled read/write access is rendered and part of it didn't without any error in build nor in editor or at least warning. Just full silence and different results in build and in editor. Such a simple thing to log at least warning when using mesh with PS without read/write access enabled...