You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vi trenger en lydeffekt når en av spillerne kolliderer med målet og glasset knuser.
Fremgang:
Gå til "Prefabs"-mappa, marker "Player" og i Inspector oppe til høyre klikker du "Open prefab"
"Add Component" -> "Audio source"
Lag eller finn en royalty free lydfil som du synes passer bra
Lag eller finn "Sounds"-mappe
Dra inn fila di her
Drag&drop fila inn som "AudioClip" i Inspector->AudioSource
Fjern hake ved "Play On Awake"
I "PlayerCollision" må du finne "OnTriggerEnter" og bruke GetComponent<AudioSource>().play() (merk liten p i play)
Go wild
OBS: Hvis det er flere AudioSources vil du måtte bruke GetComponents<AudioSource>() (med s) for å få et array og så velge riktig. De kommer i samme rekkefølge som vist i Inspector
The text was updated successfully, but these errors were encountered:
Vi trenger en lydeffekt når en av spillerne kolliderer med målet og glasset knuser.
Fremgang:
Gå til "Prefabs"-mappa, marker "Player" og i Inspector oppe til høyre klikker du "Open prefab"
"Add Component" -> "Audio source"
Lag eller finn en royalty free lydfil som du synes passer bra
Lag eller finn "Sounds"-mappe
Dra inn fila di her
Drag&drop fila inn som "AudioClip" i Inspector->AudioSource
Fjern hake ved "Play On Awake"
I "PlayerCollision" må du finne "OnTriggerEnter" og bruke
GetComponent<AudioSource>().play()
(merk liten p i play)Go wild
OBS: Hvis det er flere AudioSources vil du måtte bruke
GetComponents<AudioSource>()
(med s) for å få et array og så velge riktig. De kommer i samme rekkefølge som vist i InspectorThe text was updated successfully, but these errors were encountered: