- Home /
Add AudioSource-Like Range to Script
So you're editing the AudioSource component of a GameObject in the Inspector, and you see the blue circles appear in the 3D scene view, showing the bounds of the AudioSource's Min and Max Distances. I have several scripts with similar "range" concepts, and properties for setting these ranges within the Inspector. Here's my question: Is there like some attribute that I can add to my script or to those properties, so that they'll render a "range" gizmo similar to an AudioSource?
Thanks in advance!
Answer by Rabadash8820 · Nov 10, 2015 at 08:14 AM
To future Googlers, I came up with an answer myself. Use SphereCollider components with the IsTrigger property set to true. The sphere of influence will then show in the editor, and you can use the OnTriggerEnter, OnTriggerExit, and OnTriggerStay methods of the component in your scripts.
Your answer
Follow this Question
Related Questions
Get specific component on gameobject after order in inspector 1 Answer
What happened to conveniently replacing component scripts in the inspector? 1 Answer
[Range] attribute saves to undo-history too often. 1 Answer
Where can I find a complete list of Attributes and how they work and 2 Answers
Structuring view of my script/component in Inspector 0 Answers