- Home /
The question is answered, right answer was accepted
Script reset
I have a dialog parser script in my game that runs a certain dialog, but once it's done it gets stuck on the last frame regardless of what I do (that's supposed to happen because some of the dialogs are not supposed to repeat). But in the case where I want a dialog to repeat, is there a way where I can make the script restore its condition to that before I hit play?
Yes, but your question lacks any detail or code with which anyone could help you debug your precise problem.
I didn't want to put the code because its almost 500 lines long.
What I mean to say is that, every time you hit stop and hit play again, all the scripts, objects, everything is reset. Is there a way to reset things w/o deleting them and reinstantiating them and doing so w/o stopping the game?
Yes you can, use (C#):
YourScript script = YourObject.GetComponent<YourScript>();
Destroy(script);
and add again through AddComponent
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Permanent handles (when object is not selected) 1 Answer
Webplayer: Why can't we call private member function from a constructor? 0 Answers
CustomEditor for 2 List to look like dictionary 1 Answer
Determining which Asset is connected to a GameObject. 3 Answers