driven-decals
driven-decals copied to clipboard
Prefabs not working correctly
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:
- Create an empty game object as a prefab
- Add a mesh object
- Add a Driven Decal Asset
- Project the mesh
- Close the prefab tab
- Re-open the prefab Tab
- The decal is gone.
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!
Hi, I've got the same problem with prefabs not updating and decals disapearing.
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 ;-;
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:
- Open prefab in prefab mode
- Create Decal gameobject and project it.
- Add the SerializeMesh script to decal gameobject (from link above)
- Click "Serialize" on SerializeMesh script.
- Save the prefab.
Now, if the prefab is instantiated during runtime, the decals are properly displayed.