Hello! I’m somehow new in game developer, and I have a problem… I have a script that changes the material of an object,the script works but I want the last material that is on the object to save in PlayerPrefs. I couldn’t find any posts to help me…Can you help me? Thanks!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChangePlayerColor : MonoBehaviour
{
public Material[ ] material;
Renderer rend;
private void Start()
{
rend = GetComponent<Renderer>();
rend.enabled = true;
rend.sharedMaterial = material[0];
}
public void Update()
{
}
public void Blue()
{
rend.sharedMaterial = material[1];
}
public void Yellow()
{
rend.sharedMaterial = material[2];
}
public void Green()
{
rend.sharedMaterial = material[3];
}
public void Purple()
{
rend.sharedMaterial = material[4];
}
public void Roz()
{
rend.sharedMaterial = material[5];
}
public void Aqua()
{
rend.sharedMaterial = material[6];
}
public void Red()
{
rend.sharedMaterial = material[0];
}
public void FadeBlue()
{
rend.sharedMaterial = material[7];
}