- Home /
Calling an entire script through another script
Hi,
I have two scripts. I need to know if it's possible for me to call script2 from within script1. Not just 1 function from script2 but the entire script. Is this possible? If so, would someone mind telling me how to do this?
I'm using JS.
Thanks in advance!
That's not something that really makes much sense, because at no time do you ever run entire scripts at once anyway. Unless the entire script consists of one function of course. But in that case all you have to do is call that function.
OnGUI is a callback function meaning that if it is detected on a script attached to a Game Object then it will automatically be called by the Unity framework. Calling it any other time other than when the framework wishes to call it has no meaning.
Cool, would you $$anonymous$$d adding your solution as an answer so we can close this question?
Answer by decerto · Jun 13, 2012 at 10:27 PM
I got it.
endmenu=GameObject.FindWithTag("playerBall").gameObject.GetComponent(fallfail);
endmenu.enabled = true;
Thanks
@cadviz: What do you mean with "whole"? This piece will just enable the script called "fallfail" on the first gameobject that is tagged "playerBall".
He answered his own question (which was actually badly worded like you can see by the comments above). If you have your own question, post a "real" question, but keep in $$anonymous$$d: First think about what you want to ask, second search if it has already been answered here, third if not, post your own detailed and specific question.
@Bunny83 seems to me you are his lawyer...!!?
with all my respect to you and all people here; I am really following the steps you have mentioned...
and because I am genteel and decent I shall not say a word against your insult & indignity...
Your answer
![](https://koobas.hobune.stream/wayback/20220613072621im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How Do I Modify This Variable in Another Script? 1 Answer
Remove and Add a Script via a Code 1 Answer
How to change position of a 2d game object through another? 0 Answers
Cannot access a variable in another Script. 2 Answers
I'm having trouble referencing a function from one script inside another 1 Answer