Prefab Error

Discussion and help for Easy Save 3
Post Reply
Papazingo
Posts: 3
Joined: Thu Apr 29, 2021 9:38 am

Prefab Error

Post 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.
User avatar
Joel
Moodkie Staff
Posts: 4844
Joined: Wed Nov 07, 2012 10:32 pm

Re: Prefab Error

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Papazingo
Posts: 3
Joined: Thu Apr 29, 2021 9:38 am

Re: Prefab Error

Post 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.
Papazingo
Posts: 3
Joined: Thu Apr 29, 2021 9:38 am

Re: Prefab Error

Post 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.
User avatar
Joel
Moodkie Staff
Posts: 4844
Joined: Wed Nov 07, 2012 10:32 pm

Re: Prefab Error

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Taratus
Posts: 2
Joined: Tue Feb 27, 2024 2:00 pm

Re: Prefab Error

Post by Taratus »

I encounter the same issue. Is there alsready a solution?
User avatar
Joel
Moodkie Staff
Posts: 4844
Joined: Wed Nov 07, 2012 10:32 pm

Re: Prefab Error

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply