• 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
Question by unitydev0008 · Jan 08, 2011 at 04:57 AM · errorrigidbodytriggersendmessage

Rigidbody and collider Sendmessage delay error

Hey guys i have a slight problem, its not actually effecting gameplay but i dont like errors in my log =P. Anyways the problem is this. I have a projectile with a rigidbody attached and set to is Kinematic, and i have another object with a box collider and set as a trigger. When my projectiles OnTriggerEnter goes off i have it do a sendmessage to the collider if its tag is the right one which decrements thats gameobjects health. Now the problem is that my projectiles shoot in pairs so there are instances where when they collide into the trigger it only takes one of them to kill the trigger object thus deleting it. However the other projectile still attempts to sendmessage the trigger because both projectiles hit at the same time generally and generates SendMessage AdjustHealth has no receiver! error in my logs. Is this a huge issue to have in the warning logs or is this just some kind of unfixable/ not important error that i can leave alone?

I hope i described it well enough and thanks in advanced for your help!

Comment
Statement
NumbedShot

People who like this

2 Show 0
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

1 Reply

  • Sort: 
avatar image
Best Answer

Answer by Statement · Jan 08, 2011 at 10:18 AM

You probably use DestroyImmediate in your source of AdjustHealth. Try using Destroy instead, since it will postpone the deletion to the end of the frame, after your physics callbacks.

Another option would be to check the receiver for null and use SendMessageOptions.DontRequireReceiver.

If you're serious about your production, treat all warnings as errors. Fix them before going to bed. Don't take shortcuts. :)

Comment
Eric5h5
unitydev0008
NumbedShot

People who like this

3 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 unitydev0008 · Jan 08, 2011 at 08:24 PM 0
Share

HI statement and thanks for the reply, currently i am using destroy and not destroyimmediate on both objects. But i think the second option will fix the issue, cant really test it atm but i will get back to ya when i do. Thanks again!

avatar image unitydev0008 · Jan 08, 2011 at 08:37 PM 0
Share

Sorry to double post just wanted to thank you again Statement as this did fix the problem! I dont like anything in my log unless i put it there and it was bothering me lol thanks again man!

avatar image Statement · Jan 08, 2011 at 11:36 PM 0
Share

As long you know what you are doing when you are using DontRequireReceiver. It means that there is no longer any contract that there has to be a script handling the call. For many situations this is the case, but if you know that you always should expect some script to handle the call then you probably have another deeper problem. Don't worry, I wouldn't be answering questions if I didn't like helping out :)

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Check for rigidbody presence when in collision with a trigger 2 Answers

instantiate a Rigidbody not work for me? 2 Answers

How to use rigidbody.MovePosition within OnTrigger? 0 Answers

Conveyor belt physics 1 Answer

i have the code to move my rigid body upward. 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