Hi,
I have a small problem when I change the material of an object which is here the player
The problem is that, for example, if the player reaches the level where the player changes material, which is a simple black material and if he then decides to load a save on another level, the player keeps his black material.
It no longer has its original material. I added a "Remember Material" component on the player but it doesn't change anything. What should be done to avoid this kind of problem ?
Thank you for your answers.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
In order to save references to asset files, like Materials, you need to ensure that such files have unique filenames, and are placed in an folder named Resources in your Project window.
To be able to load between both states, both the new and old Materials will need to be set up this way.
More details on this topic can be found in the Manual's "Saving asset references" chapter.
Thank you, I'll read the chapter.
I did everything but it didn't change anything.
I installed the unity addressable package. I checked the box "Save asset reference with Adressables".
I checked the addressable box for the materials used:
Le groupe adressable est bien activé.
But as I explained before, if we load a save while the character has the black material in a level, he keeps this material and conversely, if the character has his base material and I load a save with level where he should have the black material, he keeps his original material.
You will need to ensure that the Addressable key matches the asset's filename.
If you haven't used Addressables before, I recommend the Resources method I mentioned above, however.
I did the first method by creating a Resources folder in the Assets folder but it didn't change anything.