var Audio : AudioClip;
private var Som = false;
function OnTriggerEnter(){
if (!Som) {
audio.Play();
Som = true;
}
}
//So can you guys explain what is that symbol?
var Audio : AudioClip;
private var Som = false;
function OnTriggerEnter(){
if (!Som) {
audio.Play();
Som = true;
}
}
//So can you guys explain what is that symbol?
The “!” character is often called a “pling” or indeed an “exclamation point” or “exclamation mark.”
In computing languages, it applies to booleans and means "not"
So if you have a boolean called x that is true, then
! x
would be false.
Hopefully that makes sense. “!” gives you the opposite of a boolean. If true, then false. If false, then true.
the ontriggerEnter is called only once when you enter a collider whose istrigger property is true in inspector.
thats why it is played Once and not in a loop.