I’ve got a game with a certain objects that moves, It’s level - based game,
and it has a store scene, now what I mean I want to do is if someone spends coins in the shop scene
I want to have PlayerPrefs of the mesh-filter of the object, let’s say if he spends 500 coins, I want the object to have that exact X mesh-filter and if 1000 coins then that Y one.
How can I do that?
I mean I know I can use like PlayerPrefs.SetInt(“Mesh-Filter-Choice”,2)
but how do I continue from there? create an array of mesh-filters on the object?
How do I access that array from the store scene and how do I apply that exact mesh-filter into my gameObject?
help would be MUCH appreciated!
Try creating a script with a public mesh array on it. Then, you can drag and drop your meshes from your assets onto the array in the editor.
From here, you can store the index of the array that corresponds to the currently equipped mesh. Then to actually load the mesh onto the object, you’d say something like:
GetComponent<MeshFilter>().mesh = cosmetics[PlayerPrefs.GetInt("CurrentMesh");
Hope this points you in the right direction. -Greg