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
2
Question by montblack · Jan 07, 2011 at 03:46 PM · objectfunctioncallanother

call a function of another object

I need help with this problem.

I have an object that is cloned 2 times, and an object that manages the mouse, I need that when the object that manages the mouse, press click on one of these 3 objects then send a message to the method of that object by giving the order to jump sit or stand still.

How do I send a message from script to script an object from another object to perform an action?

attached a sample image

necesito ayuda con este problema. tengo un objeto que es clonado 2 veces, y un objeto que administra el ratn, necesito que cuando el objeto que administra el ratn, presione clic sobre uno de estos 3 objetos entonces se enve un mensaje al mtodo de ese objeto dando la orden de saltar sentarse o quedarse quieto. como le envo un mensaje del script de un objeto al script de otro objeto para que realice una accin? adjunto una imagen de ejemplo

alt text

Comment
Add comment
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

2 Replies

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

Answer by Justin Warner · Jan 07, 2011 at 04:03 PM

I need help with this problem.

I have an object that is cloned 2 times, and an object that manages the mouse, I need that when the object that manages the mouse, press click on one of these 3 objects then send a message to the method of that object by giving the order to jump sit or stand still.

How do I send a message from script to script an object from another object to perform an action?

attached a sample image

Eso podra ayudarle. Traducido para otros y ayudar, porque mi respuesta no es el lamento mejor y ms eficiente.

http://unity3d.com/support/documentation/ScriptReference/Component.BroadcastMessage.html

That might help you. Translated for others to help, because my answer isn't the best and most efficient, sorry.

Comment
Add comment · Show 4 · 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 FLASHDENMARK · Jan 07, 2011 at 04:05 PM 0
Share

You speak spanish? Nice :)

avatar image Justin Warner · Jan 07, 2011 at 04:14 PM 0
Share

LOL, I failed every spanish class except spanish 1... I used Google translate XD. It works amazingly... surprisingly. Haha.

avatar image montblack · Jan 07, 2011 at 07:13 PM 0
Share

thanks, I had an error with the name of the object that the broadcast did not work or sendmessage.

avatar image FLASHDENMARK · Jan 07, 2011 at 07:16 PM 0
Share

Well, i also use google translate for all my german assignments. :P it works though :)

avatar image
0
Wiki

Answer by montblack · Jan 07, 2011 at 06:31 PM

BroadcastMessage not work, that calls a function within the same object or the object is a child but I need to call a function of another object.

Why? I need to select an object and give the order to move to a point that I select with the mouse, then I need from the object "MAIN"which has the script "CURSOR"send a message with the click position the objects that I have selected.

alt text

Comment
Add comment · Show 1 · 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 montblack · Jan 07, 2011 at 06:45 PM 0
Share

i try with:

GameObject go = GameObject.Find("montblack"); go.Send$$anonymous$$essage("cambiar",1);

and doesn't work

"Send$$anonymous$$essage cambiar has no receiver!"

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

No one has followed this question yet.

Related Questions

How to call a function from a script component on another object 1 Answer

Call a Function from another Script 1 Answer

Call function in another script? 1 Answer

how do I make a Object getcomponent and call a function 1 Answer

Calling a function from a different script on the same object 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