Hi i am working on a game in which i created a character selection scene in which i show the player some models with different materials now i want those materials to pass onto the gameplay scene without changing the models here is the code in the receiving side the code is almost same on the selection side too. the script i am getting data from is MainMenu script.
public GameObject BabyPajama;
public GameObject BabyDiaper;
public SkinnedMeshRenderer BabyPajamaRenderer;
public int selectedIndex;
void Start()
{
ReplaceSuit(PlayerPrefs.GetInt("UnlockedSkin"));
//PajamasTexture = MainMenu.Instance.PajamasTexture;
//BabyPajamaRenderer = MainMenu.Instance.BabyPajamaRenderer;
//selectedIndex = MainMenu.Instance.sId;
}
void Update()
{
}
public void ReplaceSuit(int index)
{
selectedIndex = index;
for (int i = 0; i < 5; i++)
{
if (index == 0)
{
BabyDiaper.SetActive(true);
BabyPajama.SetActive(false);
}
else
{
BabyDiaper.SetActive(false);
BabyPajama.SetActive(true);
}
if (i == index) Hair[i].SetActive(true);
else Hair[i].SetActive(false);
}
BabyPajamaRenderer.materials[1].mainTexture = PajamasTexture[index];
}
}