I'm trying to save my material using playerprefs on the runtime also changing it. But it is not working on restarting the game the skins doesn't stay the same. It's just changes to the default skin.
Here is my script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class manager : MonoBehaviour
{
public Renderer skinRenderer;
public Material mat1, mat2;
public void Start()
{
PlayerPrefs.GetInt("skinSAVED",1);
}
public void gold()
{
skinRenderer.sharedMaterial = mat1;
PlayerPrefs.SetInt("skinSAVED", 1);
PlayerPrefs.Save();
}
public void purple()
{
skinRenderer.sharedMaterial = mat2;
PlayerPrefs.SetInt("skinSAVED", 1);
PlayerPrefs.Save();
}
}
↧