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 BortStudios · May 03, 2012 at 10:28 PM · colliderobjectoutside

Check for collisions with script outside of object with collider

In the game I'm making I have what are basically short quests. These quests are initiated when the player steps into the BeginQuestCollider for the specific quest, and ended when the player completes the quest, let's say for an example it is completed by putting a box on top of another box.

My game is made up of many of these quests, so how I want to do it is have an game object that is there only to hold all of my quests and check for them starting / being completed. So, for the quest I have described above, I have the script for the quest that has public fields where I can drag and drop the colliders of the different parts of the quest into the script, so it knows which collider serves as its begin quest collider, which collider is the box's the player will be moving, and which collider it is the player has to move the box into.

The problem here is I cannot find a way to check these colliders against each other from the script. If I were to separate this quest so I could use the OnTriggerEnter function, I would have to have a minimum of two instances of the script: one on the start quest object, and one on the object where the player has to drop the box to be checking for the box. I would much rather have the quest outside of all of that, sitting back in its QuestManager object along with the scripts for all of the other short quests, checking the colliders against the colliders that I drop into its public fields. Is there a way to do this?

Thanks a bunch!

Comment
Add comment · Show 3
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 Zaapp · May 04, 2012 at 01:11 AM 1
Share

Forgive me if this approach is naive/not what you wanted, but could you just call OnTriggerEnter on the script for your Quest$$anonymous$$anager from a script attached to the place where you're dropping the box?

void OnTriggerEnter(Collider other) { Quest$$anonymous$$anager.Instance.OnTriggerEnter(other); }

It sounds like it'd be easier to use a notification system where the box_drop_location notifies the Quest$$anonymous$$anager rather than the Quest$$anonymous$$anager keeping a reference to every box_drop_location.

avatar image BortStudios · May 05, 2012 at 02:26 PM 0
Share

It seems like I may have to do this. I just didn't want to have a script on every part of every quest, as the number of very tiny scripts that do almost nothing will be enormous.

avatar image rutter · May 05, 2012 at 06:43 PM 0
Share

If you do go that route, you may have an easier time of it by adding those scripts through code with calls to AddComponent(), whether at runtime or in an editor script.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Raycast Destroy(hit.collider.gameObject); (Still need help) 1 Answer

Function action applies to every object that have script with that function on it. Help please 1 Answer

Appear and Dissapear: Fog 1 Answer

Pickup Bullets 1 Answer

how to make an object move around 3 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