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 PhoenixBlackReal · Mar 09, 2015 at 11:49 PM · c#trigger

Check when OnTriggerEnter() stopped firing

I need to get a list of all objects that are making the trigger trigger. This is easy, but the problem is - I need to know when the OnTriggerEnter has gathered all the objects and added them to a list, simply put - when the list is complete. I am yet to find a good way around doing this. Regards, Adas Lokys

Comment
Add comment · Show 4
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 Glurth · Mar 10, 2015 at 12:10 AM 0
Share

a list of all objects that are making the trigger trigger. This is easy

ok, this is one list, lets call it TriggeredList. I'll assume you don't add duplicates.

when the OnTriggerEnter has gathered all the objects

ok, this is another list, that I assume you have BEFORE you need to check the triggers. Lets call it AllTriggerables

Can't you just compare the Count or Length of both these lists? If equal, all objects have been added. Clear the TriggeredList if you want to start over.

avatar image PhoenixBlackReal · Mar 10, 2015 at 12:19 AM 0
Share

That's the point, there is no predefined list. There can be any number of objects in the trigger area. Once the trigger appears in that area it gathers all the objects that are making it trigger into a list. Now getting when it is complete is another thing.

avatar image Glurth · Mar 10, 2015 at 12:25 AM 0
Share

Ah, "the trigger appears", is important.

Hmm, not really sure about this, but I would suspect(and hope), that you need to wait one FixedUpdate() cycle for all the collision to be detected.

avatar image PhoenixBlackReal · Mar 10, 2015 at 12:32 AM 0
Share

Pardon me if I was not too clear - I've been coding all my waking time through nights for a few days... The entire idea is this, and I will try to be as clear as possible: I'm making a snap area. An object is moving by a certain point and, when it is close enough, a trigger of the same shape as the object appears in that spot. If it picks up that there is another object in the trigger area, it will not allow snapping. Otherwise the object teleports to that place. I know for certain there will be at least 1 trigger at the snap area, so it's a start - if there is more than one, then snapping cannot happen. But the snap function does not wait to find out if there is more than one object in the snap area, so waiting through an entire cycle might be the way. Not sure how to implement it yet.

0 Replies

· Add your reply
  • Sort: 

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

22 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

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

[c#] Texture-based Trigger? 1 Answer

OnTriggerStay only happens when I move?(c#) 1 Answer

Erratic trigger behavior, I can't find the fault. 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