Question by
shadowpuppet · Aug 05, 2016 at 06:55 PM ·
texturescustomizationswap
texture swap
I found how to change the textures of my character thus being able to customize him by but how do you get those changes to stick? I select the textures I want and play the game for a bit, then save it. But when I leave the game to go to the start menu then back to the saved game the default textures are back.Or if I finish the level and go to the next level the default textures are back. Is this data I need to have stored in the "save game" script?
using UnityEngine;
using System.Collections;
public class SwapTextures : MonoBehaviour {
public Texture[] textures;
public int currentTexture;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown (KeyCode.Y)) {
currentTexture++;
currentTexture %= textures.Length;
renderer.material.mainTexture = textures[currentTexture];
}
}
}
Comment
The character is a prefab so the changes should pass level to level but it's like I need to have the equivalent of the "apply" button for the character but in playing a build