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 lukasvogl · May 07, 2013 at 09:41 PM · error messagereceiver

SendMessage has no receiver

hi i get an error on my c# script "SendMessage GetSpeed has no receiver"

 gameObject.SendMessage ("GetSpeed", dir);

here is my receiver void GetSpeed(Vector3 thespeed) { speed= thespeed.magnitude;
}// GetSpeed

the strange thing is that the function receives the call and works fine. any ideas on that?

Comment
Add comment · Show 9
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 whydoidoit · May 07, 2013 at 09:42 PM 2
Share

Guess you are also calling it on something that doesn't have that receiver...

avatar image Crazydadz · May 07, 2013 at 10:46 PM 1
Share

Add options to your sendmessage Send$$anonymous$$essageOptions.DontRequireReceiver.

avatar image Bunny83 · May 07, 2013 at 10:51 PM 2
Share

@Crazydadz: That's not a great solution. There's a reason why the default option is require receiver. If you send a message it has a purpose. If you get this error that means something is wrong. Using DontRequireReceiver just suppress the error.

avatar image DaveA · May 07, 2013 at 11:37 PM 1
Share

DontRequireReciever is not about suppressing an error. You may (or may not) have object which have receivers. Example: if you have an 'Explode' function on some objects, and not others, but you instantiate them and parent them under some container like 'pinata'. Then Send or Broadcast message to those things which may or may not have 'Explode on them, by design. Because some things explode, some do not, and you may not know at that point which do or do not.

avatar image whydoidoit · May 08, 2013 at 07:07 AM 1
Share

I don't know how I can put this any differently.

  • You have a component which is working - that has a receiver

  • You must have another instance where there is not a receiver or the message would not show up.

The reason it works when you take it out of Update is that you are not calling the function that it then resides in, or you are adding the receiver component after the first call to Update.

Show more comments

1 Reply

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

Answer by DaveA · May 07, 2013 at 11:35 PM

Try BroadcastMessage. My guess is you're sending to the parent of the object where your script actually is?

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

16 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

Related Questions

Assets/Scripts/GameManager.cs(24,33): error CS0029: Cannot implicitly convert type `bool' to `int' 0 Answers

Versy confusing argumentoutofrangeexception error 1 Answer

'invalid generated path' when I create a new file 1 Answer

Can't Get animation.Play to work 0 Answers

I am not able to start unity as I am getting this error before opening the unity 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