driven-decals icon indicating copy to clipboard operation
driven-decals copied to clipboard

Prefabs not working correctly

Open SBird1337 opened this issue 3 years ago • 4 comments

When adding a decal to a prefab the Editor Tool does not recognize static meshes, if you deselect All static meshes and apply it to a mesh manually it will render correctly at first, but after re-opening the prefab or placing it in a scene the decal will disappear.

Steps to reproduce:

  1. Create an empty game object as a prefab
  2. Add a mesh object
  3. Add a Driven Decal Asset
  4. Project the mesh
  5. Close the prefab tab
  6. Re-open the prefab Tab
  7. The decal is gone.

SBird1337 avatar Mar 06 '21 15:03 SBird1337

Thank you for the report. I've been able to reproduce the issue, and will work on fixing it. It's definitely something that needs correcting!

Anatta336 avatar Mar 07 '21 12:03 Anatta336

Hi, I've got the same problem with prefabs not updating and decals disapearing.

richgizmo avatar Mar 15 '21 11:03 richgizmo

Can confirm it doesn't work with prefabs & that prefabs instantiated it also breaks with. This will probably prevent me from using it on our project unfortunately ;-;

kriller509 avatar Jun 07 '21 16:06 kriller509

This is probably because the generated decal mesh is not properly serialized and saved by Unity when prefab is closed.

The workaround to similar issues seems to be to use some sort of simple serialization to store the mesh data in the prefab. Example: https://forum.unity.com/threads/solution-save-a-prefab-with-a-generated-mesh-es-without-creating-assets.463496/

I'll test it and report back.


Edit: Yep, using the script from the thread above the prefabs indeed do work correctly.

The workflow is:

  1. Open prefab in prefab mode
  2. Create Decal gameobject and project it.
  3. Add the SerializeMesh script to decal gameobject (from link above)
  4. Click "Serialize" on SerializeMesh script.
  5. Save the prefab.

Now, if the prefab is instantiated during runtime, the decals are properly displayed.

chisely avatar Sep 16 '21 15:09 chisely