- Home /
The question is answered, right answer was accepted
Need help <3
Hello hope you are all well, I'm sorry to be bothering you all today,
I started learning to code about a day ago never done it before but I'm planning on making a simple app. Where at the home screen there is an option, to pick things for you to do, Like I could press a button for "What shall I drink" then the next scene loads and with TextMeshPro it should say "Have a nice cup of coffee". I got the Scene loader down when I press the button, But I am not sure how making the next scene load up with a Random sentence already loaded as soon as it loads into the next scene.
I was kind of hoping to make all the selections random and for all the sentences to be added with [SerializeField] so I don't have to keep changing it in the code but can do with unity and end up with like 20+ options all randomized. Sorry if my explanation isn't clear enough.
There really isn't need to have a scene for each response. You could just select a random response from a string array and display that.
The scene is for the next screen So if I Press What shall I have to drink, the next scene will show "have a hot cuppa coffee" then with another button "What Shall I eat".
It doesn't need a new scene though, you could all that in one and then have a nice swipe effect as the 'current screen' goes off to the left and the 'next screen' comes in from the right.
Answer by NikLaws · Mar 09, 2019 at 03:02 PM
If I correctly understand what you're trying to do - you will need to add a c# script and attach it to the 2nd scene. The void Start() function is called as the scene is loaded. There you can set the text to whatever you want it to be and it will be loaded with the scene.
edit: However, as WarmedxMints said, there really is no need for another scene to do something as simple as that.