Add object using other scene,Change something in scene from the menu
Hi! Can anyone help me? My problem is: For example in menu (scene 1) there are two buttons with levels of difficulty: “hard” and “easy”. If we press button “hard” object (in scene 2) must return to “true”. But if we press button “easy” nothing must not happen. I hope you can help me;) Thank you..,
(Bad English)
Answer by matveynovoselov · Apr 08, 2020 at 01:11 PM
You just need to add object with "not destroy on load". It will help you to change settings between scenes!
Answer by ray2yar · Jan 21, 2019 at 07:33 PM
If that is a UI button then this is easy.
On your game script have public function like this:
public void ButDifficulty(bool which)
{
//do something with the value 'which'
//set your difficulty
//something like
//diffulty = which;
}
Now in the inspector find your button and the event trigger, there should be an option to drag and drop a gameobject into the event trigger. Then you can pull down the list of functions on the gameobject, select the function above. Finally in the inspector, for the "hard" type "true" and for the easy type "false".
Your answer
Follow this Question
Related Questions
i need help with enemy respawn 0 Answers
Saving Data (please help) 0 Answers
Hi everyone.need help with this. 1 Answer
When object (sphere) come to specific position, change scene (C#) 0 Answers
how do i rotate an object? C# 1 Answer