Page 1 of 1

Prefab Error

Posted: Thu Apr 29, 2021 9:45 am
by Papazingo
Hi,

I'm attempting to save and load a prefab that was instantiated at runtime, i tried just saving the parent gameobject however the models dont show as the Meshfilter is missing the mesh file. I then enabled easy save for prefab and saved the actual prefab however i am now receiving this error

"Not allowed to access MeshFilter.mesh on Prefab object. Use MeshFilter.sharedMesh instead"

the mesh files are referenced but every time i load up the game the mesh files are missing from the instantiated prefab.

Please help lol.

Re: Prefab Error

Posted: Thu Apr 29, 2021 10:03 am
by Joel
Hi there,

This usually means that your Mesh is instantiated or modified at runtime (for example, you're accessing the MeshFilter.mesh field, which creates a copy of the mesh which will no longer exist when you leave the level).

Just to check, are you accessing the MeshFilter.mesh field anywhere in your own code?

All the best,
Joel

Re: Prefab Error

Posted: Thu Apr 29, 2021 10:45 am
by Papazingo
Thanks for your reply,

When you say "accessing the MeshFilter.mesh field in your own code", do you mean my save code? No other code accesses the mesh. I'll quick explain the use, i have a script that instantiates multiple of the same prefab in a line when the mouse is held down(building a wall). I just need the placed walls to be saved on loading.

Re: Prefab Error

Posted: Thu Apr 29, 2021 11:30 am
by Papazingo
Hi Joel,

I managed to get the prefabs to save correctly, i had both mesh and sharedmesh tickboxes ticked in the meshfilter type, once i unticked mesh they saved correctly.

I do have another issue tho, the materials seem to save fine however the textures applied to the material dont seem to save, will these need to be saved individually?

Also after testing, when i save and load these prefabs, i noticed after stopping the game the materials have been removed from the prefab in question.

Re: Prefab Error

Posted: Thu Apr 29, 2021 11:36 am
by Joel
Hi there,

Please could you replicate this in a new project with a basic scene and private message it to me?

All the best,
Joel

Re: Prefab Error

Posted: Tue Feb 27, 2024 3:50 pm
by Taratus
I encounter the same issue. Is there alsready a solution?

Re: Prefab Error

Posted: Tue Feb 27, 2024 4:02 pm
by Joel
Hi there,

The behaviour they were experiencing was explained by the guide here:
https://docs.moodkie.com/easy-save-3/es ... nd-warning

I.e. you can't load a reference to something which doesn't exist. See the guide for information on how to deal with this.

All the best,
Joel