- Home /
Question is off-topic or not relevant
I don't really know what the question is here...
Hey, I just added a shop feature to my game, before I start work on powerups etc. I'm just trying something simple. I want players to be able to change the color of their character. Here are the conditions on that, the shop is in a complete different scene to the level and main scene, so a player opens the game, chooses the shop from the main menu, that then loads the shop scene, when they have chose their color they then go back to the main menu scene, and hit play which will then load the level 1 scene, the only problem is it won't change the color... To make this short and quick, the player "Opens the game > selects the shop opening a new scene > selecting a color > going back to the main menu scene > hitting play opening the level 1 scene" and what would you know it doesn't show, so how can I get this to work? I know this was a hard to follow question and I'm not the best at explaining so anything you need clarifying let me know! Thanks...
Good day.
How the program "chose" the ncolor when starting the Play scene? from were it "reads" the color? how you store the color chosed ?
The game developing is not magic, there is code doing all of that, we need to know that code, or at least what functions are you using. If not, we can not help you!
Are you using a script with the DontDestroyOnLoad?
Extend your post!
Bye!
Or you can use playerprefs to store player's currunt color and set color when level load
I made this thread to get help from the community, I would not ask this question if I knew how to do it, as of now I have no code other than the basic navigation through menus. I am wanting someone to comment something that I can base an idea of as I have no idea on how to do this...
Answer by KittenSnipes · Apr 18, 2018 at 07:56 AM
@gm091203 So I think a good way to change color is either changing the color of the material or changing to a different material. Here is an example:
//We are just buying the skin so we can just set a bool up:
hasRedSkin = true;
Then all you need is a if statement I guess something like:
bool hasRedSkin;
//You can set new mat
public Material newMat;
//or set it as a new color
public Color newColor = Color.red;
if (hasRedSkin) {
GetComponent<Renderer>().material = newMat;
//or this:
GetComponent<Renderer>().material.color = newColor;
}
I don't exactly understand this, I have to pass this across 3 different scenes and I'm not quite sure how to do that, I know how to change the colors of everything I just need that information to pass across scenes to reflect in the third and final scene which is level 1