- Home /
Other
How to run onstart and fix this error
https://m.youtube.com/watch?v=_nRzoTzeyxU
Im tryna follow this tutorial because im not used to unity’s UI and am tryna learn more by modifying code to see what it can and cant do
Im trying to get the code to start on load instead of clicking a button to start I just want the method “StartDialouge(Dialogue dialogue);” to run on load (Ive tried putting it into the start(){} but it returns an error and refuses to run it saying there is no argument given(etc.) I digress) Im trying not to use colliders because if i need to start a tutorial or an intro or am making a game with out colliders in the future then it wont work... im lost and have been tryna wrap my brain around it for two day but i give up any help appreciated thanks
Heres the codes its 3 seprate methods
Answer by SpeakBeaver · Aug 13, 2018 at 05:39 PM
because you give no argument like the error told you , your method
StartDialouge(EndNarration dialogue);
need to have an argument of type EndNarration (in your screenshot) and you give nothing because you call it like this
StartDialouge()
You need to create a variable of type EndNarration and give to her some sentence and call it in your awake function like this
StartDialouge(EndNarration yourVariable)
That's all
And no need to have a serializable object in your case right now (serializable objects are used to store and receive json data for exemple), try to make simple class with basic constructor with hard coding sentences to understand correctly what your are doing (I speak about your EndNarration class)
Sorry i didn’t explain that i had done this and it still returned an error i will post that error as well when i get home(on break at work rn) will edit comment when i get home
The error it returns is EndNarration is not a valid type
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
UI Text error 1 Answer
Multiple NPCs 1 Answer
How to change a notepad file for another notepad file? 1 Answer