سؤال

giveacodicetagpre.

من المفترض أن يلعب هذا صوتا عندما تصطدم شخصيتي بابيا، لكنه لا أستطيع أن أفهم لماذا

هل كانت مفيدة؟

المحلول

Take it through simple steps; verify first with a bit of debug that your code is reaching OnControllerColliderHit, then reaching OpenDoor(hit.gameObject); Also confirm that it can play door.transform.parent.animation.Play("doorOpen"); (and make a sound in normal code rather than conditional)

From the code snippet it may be that your "playerDoor" definition is incorrect elsewhere

نصائح أخرى

Go to Project then Book Assets Folder then sounds folder then drag Door_open sound to these variables:

var doorOpenSound : AudioClip; var doorShutSound : AudioClip;

Your sound will play.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top