Hey Dude..
I'm back again, listen I wanted to ask you is it possible if I create a collison to play an audio with subtitles with the help of Dialogue System? If so, how?
Play Audio on collison
Re: Play Audio on collison
Hi,
The objects that collide must be configured to register collisions. That is, their layers must allow collisions (Edit > Project Settings > Physics), and they must have colliders and rigidbodies.
For example, let's say one object is the player, and the other object is a rubber chicken. When the player steps on the rubber chicken, it will play an audio file named 'squeak'.
Both objects have colliders and rigidbodies. The player's layer is Player, and the chicken's layer is Default. You've confirmed in Edit > Project Settings > Physics that these layers allow collisions.
To set up the Dialogue System part:
1. Put the audio clip ('squeak') in a folder named 'Resources'.
2. Add a Dialogue System Trigger to the GameObject with the collider (chicken).
- Set the Trigger to OnCollisionEnter.
- Set Conditions > Accepted Tags to the tag of the object that will collide with it (Player).
- Select Add Action > Bark.
- Set Bark Source to Text.
- Set Bark Text to the subtitle (e.g., 'Squeak!').
- Set Bark Text Sequence to:
3. Add a Dialogue Actor to the GameObject (chicken).
- Assign a bark UI prefab to Bark UI Settings > Bark UI. You can start with Dialogue System / Prefabs / Standard UI Prefabs / Templates / Basic / Basic Standard Bark UI. Once you've confirmed it's working, you can replace it with a custom prefab.
The objects that collide must be configured to register collisions. That is, their layers must allow collisions (Edit > Project Settings > Physics), and they must have colliders and rigidbodies.
For example, let's say one object is the player, and the other object is a rubber chicken. When the player steps on the rubber chicken, it will play an audio file named 'squeak'.
Both objects have colliders and rigidbodies. The player's layer is Player, and the chicken's layer is Default. You've confirmed in Edit > Project Settings > Physics that these layers allow collisions.
To set up the Dialogue System part:
1. Put the audio clip ('squeak') in a folder named 'Resources'.
2. Add a Dialogue System Trigger to the GameObject with the collider (chicken).
- Set the Trigger to OnCollisionEnter.
- Set Conditions > Accepted Tags to the tag of the object that will collide with it (Player).
- Select Add Action > Bark.
- Set Bark Source to Text.
- Set Bark Text to the subtitle (e.g., 'Squeak!').
- Set Bark Text Sequence to:
Code: Select all
Audio(squeak)
- Assign a bark UI prefab to Bark UI Settings > Bark UI. You can start with Dialogue System / Prefabs / Standard UI Prefabs / Templates / Basic / Basic Standard Bark UI. Once you've confirmed it's working, you can replace it with a custom prefab.