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 /
This question was closed Jan 01, 2015 at 05:32 AM by Landern for the following reason:

Duplicate Question

avatar image
2
Question by EggQuiz857 · Jan 01, 2015 at 05:06 AM · game-object

How do i call a function from another script in another object

I got to scripts that are in two different objects. I need script 'A' to call a function in script 'B'. and script 'B' is in a different game object, How do I do this?

Comment
Add comment · Show 2
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 EggQuiz857 · Jan 01, 2015 at 03:06 PM 0
Share

I am still confused

avatar image UtopianKing · Dec 08, 2017 at 12:29 AM 0
Share

I know this is a bit late but: You probably have to make the function public on the other game object.

That solved my problem.

1 Reply

  • Sort: 
avatar image
7

Answer by Landern · Jan 01, 2015 at 05:34 AM

This is asked WAY to often to not try and search for the answer yourself.

From unity docs:

http://docs.unity3d.com/412/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html

From unity forums:

http://forum.unity3d.com/threads/calling-function-from-other-scripts-c.57072/

From unity answers:

http://answers.unity3d.com/questions/7555/how-do-i-call-a-function-in-another-gameobjects-sc.html

http://answers.unity3d.com/questions/13248/how-to-call-a-function-from-another-script-getting.html

http://answers.unity3d.com/questions/366095/how-to-call-a-function-from-a-script-component-on.html

http://answers.unity3d.com/questions/10857/how-can-i-access-other-scripts-and-their-functions.html

From YouTube:

http://answers.unity3d.com/questions/10857/how-can-i-access-other-scripts-and-their-functions.html

and on and on and on.

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 RandomCharacters · Jun 08, 2017 at 05:49 AM 0
Share

"This is asked WAY to often" So what does that tell you???????

avatar image NoseKills RandomCharacters · Jun 08, 2017 at 06:15 AM 2
Share

What are you getting at? Have you read the FAQ?

If a question has been asked and answered here many times already, it tells me the answer should be easy to find by searching (as the answer points out). Asking the same question again doesn't help anyone in any way. Neither does resurrecting 2 year old questions.

Straight from Unity Answers FAQ: (about differences between Forums and Answers)

One problem with the Unity Forums was that old threads tended to get buried, so users ended up asking the same questions over and over again.

And also

Please look around to see if your question has already been asked (and maybe even answered!) before you ask. If you end up asking a question that has been asked before, it may end up getting rejected in the moderation queue or closed if it has been published. Other users will hopefully edit in links to related or similar questions to help future visitors find their way.

avatar image MrKirbyOfficial · Nov 21, 2018 at 02:43 AM 0
Share

Just wanted to post here, the reason this is still being asked is because half of the answers do not work. Your does. The first link is dead but the second has the solution:

YourGameObject.GetComponent<YourScript>().YourFunctionInScript(Parameters);

Follow this Question

Answers Answers and Comments

30 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Sending data to different game objects? 1 Answer

Delay befor Jump with character controller 1 Answer

How to control Another Object by using other one 1 Answer

How do I right this Java Script code in C# 1 Answer

Is there a quick way to de-activate a game object and all its children in script? 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