En este video explico una forma de poner sonidos de pasos al caminar con unity.
y pongo el script de c# que lo hace funcionar.
using System.Collections.Generic;
using UnityEngine;
public class sonidoporcolision : MonoBehaviour {
public AudioSource tickSource;
//public float Destroy = 0.2f;
// Use this for initialization
void Start () {
tickSource = GetComponent
}
void Update () {
}
//void OnCollisionEnter (Collision collision){
// if (collision.gameObject.tag == "PUYO modelo"){
//void OnTriggerEnter(Collider other) {
//if (other.gameObject.CompareTag ("Terron")){
void OnTriggerEnter(Collider other) {
if (other.gameObject.CompareTag ("Terrain")){
tickSource.Play ();
//Destroy (gameObject, 0.2f);
//Destroy (gameObject, 0.2f);
}}
}
No hay comentarios:
Publicar un comentario