function OnTriggerStay() {
audio.Play();
}
I hope somebody can make a better one. I would love to have one that only trigger sound once and stuff. Just drag and drop this script to your object. Remember to also drag and drop a sound to the same object. Tip: Do not use scripts on the objects themselves, but rather on invisible (turn of mesh render) boxes surrounding them. Remember to check them off as IsTrigger.
Source:
Reading the Unity instructions
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.