Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by decerto · Jun 11, 2012 at 08:55 AM · callinganothera

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!

Comment
Add comment · Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Eric5h5 · Jun 11, 2012 at 09:08 AM 1
Share

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.

avatar image decerto · Jun 11, 2012 at 09:09 AM 0
Share

Oh right, and how do I do that?

avatar image flamy · Jun 11, 2012 at 09:10 AM 1
Share

what exactly you are trying to do.

avatar image kolban · Jun 11, 2012 at 10:50 AM 2
Share

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.

avatar image Julien-Lynge · Jun 13, 2012 at 04:59 PM 2
Share

Cool, would you $$anonymous$$d adding your solution as an answer so we can close this question?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by decerto · Jun 13, 2012 at 10:27 PM

I got it.

endmenu=GameObject.FindWithTag("playerBall").gameObject.GetComponent(fallfail);

endmenu.enabled = true;

Thanks

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cadviz · Sep 08, 2012 at 09:54 PM 0
Share

can you please type the whole code

avatar image Bunny83 · Sep 09, 2012 at 01:11 AM 0
Share

@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.

avatar image cadviz · Sep 09, 2012 at 06:33 AM 0
Share

@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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges