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 lighting · Aug 20, 2012 at 09:03 AM · sendmessagereceiversimultaneous

SendMessage handled by one method in different components

Hi,

I've problem with SendMessage and I'm trying to find best solution:

I've one script AnimateScript.cs which contains both sending and receiving methods: SendMessage("Animate"); and void Animate() {}

The problem is that the same script is attached to many GameObjects so many times Animate() is being called. In theory. In practice only one time Animate() is being called from the same instance of script which is sending message. What may I do to be able to trigger the same method, which is in one script attached to different GameObjects simultaneously ?

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 fafase · Aug 20, 2012 at 09:04 AM 0
Share

How do you decide to call the Send$$anonymous$$essage? Is it a collision?

avatar image lighting · Aug 20, 2012 at 11:21 AM 0
Share

No collision. Just when object moves to position X, Y, Z I'm sending message. Only the same component, which sends this messages responses (however this script is attached to other components too).

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by lighting · Aug 20, 2012 at 11:54 AM

No, it's not collision. I've moving object on screen. Thus I've condition:

if (newPosition.x >= x_end && newPosition.z >= z_end) { Debug.LogWarning("SENT: "+transform.name); SendMessage("AnimFinished", transform.name, SendMessageOptions.DontRequireReceiver); }

and later: void AnimFinished(string previousName) { Debug.LogWarning("RECEIVED: "+transform.name); }

This is being attached to different GameObjects on screen. SENT and RECEIVED is logged only once.

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

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

SendMessage has no receiver 0 Answers

SendMessage has no Receiver 1 Answer

sendMessage doesn't work on objects while the object is behind the sender's transform 0 Answers

How do i Specify a Receiver for a Send Message Function? 2 Answers

SendMessage within a SendMessage Receiver 0 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