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
0
Question by martinhalldin · Nov 16, 2012 at 06:29 PM · loadingaccesswait

Accessing scripts from another script

I'm trying to make a game where the level is randomly generating and i want to make my character "wait" till the loading has reached 100%, but i couldn't figure out how so i was wondering of there's a way to access a line or multiple lines of codes from a completely different script

Comment
Add comment · Show 1
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 fafase · Nov 16, 2012 at 06:44 PM 0
Share

you have a long and fully explained tutorial here:

http://unitygems.com/script-interaction-tutorial-getcomponent-unityscript/

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Kiloblargh · Nov 16, 2012 at 06:40 PM

 var otherScript : OtherScript;
 var someValue : int = 42;

 
 function Awake ()
 {
 otherScript = GameObject.FindWithTag("OtherObject").GetComponent.<OtherScript>();
 }

 function Start ()
 {
 otherScript.aVariable = someValue;
 otherScript.DoSomething();
 }
Comment
Add comment · Show 2 · 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 martinhalldin · Nov 16, 2012 at 06:45 PM 0
Share

I'm new to scripting so I'm just wondering if there's anything I have to do like what to remove and stuff like that...

avatar image fafase · Nov 16, 2012 at 07:06 PM 0
Share

Well, I modified your answer but I realized it is not so right...

 GetComponent<Script>();

is for C#, it should be

 GetComponent(Script);

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

11 People are following this question.

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

Related Questions

Can't get script to access other script/class (c#) 1 Answer

My script accessing a variable from another script recieves an error 1 Answer

Access variable from another script? Health! 3 Answers

Accessing a function through its name stored in a string JS 2 Answers

How do I access information (eg, variables, functions, properties) on other objects from inside a script? 2 Answers


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