- Home /
Access different colliders from one one script
Hello! I was wondering if it is possible to access different colliders from one script?
I want to be able to do something like this:
I can determine that if the player enters this spesific collider, then I change a value to something, but if the player enters another spesific collider, I want the value to change to something else.
Is there any way to do this from one script? Some sort of Collider Manager? Instead of creating an "OnCollisionEnter" on every individual box collider?
Answer by logicandchaos · Oct 11, 2021 at 11:30 PM
Yes, you just need a reference to all the colliders you can use a list and populate it in the inspector or in code with FindObjectsOfType in Start.
Your answer
Follow this Question
Related Questions
How to watch variables from another script efficiently? 1 Answer
physics.OverlapSphere colliders 1 Answer
Enemy's parts are visible through the walls c# 0 Answers
2d Colliders problem 1 Answer
Insane problem with triggers 2 Answers