【问题标题】:how to make multiple sound augmented reality in 1 scene UNITY?如何在 1 个场景 UNITY 中制作多个声音增强现实?
【发布时间】:2015-12-21 15:23:14
【问题描述】:

就我而言:- 我将在 1 个场景 UNITY 中制作多个声音增强现实,但现在我只能在一个场景 Unity 中制作 1 个声音:-

我在带有音频源的 AR 相机上做到了

和声音脚本:

using UnityEngine;
using System.Collections;

public class DolSound : MonoBehaviour {

    public Transform target2; 
    public AudioSource suaradol; 

    void Start () {

    }

    void Update(){
        if(Input.GetMouseButton(0)){
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if(Physics.Raycast(ray, out hit)){ 
                if(hit.transform == target2){
                    suaradol.GetComponent<AudioSource>().Play(); 
                }
            }
        }
    }

}

请教我步骤和脚本在 1 个场景 UNITY 中制作多个声音增强现实

【问题讨论】:

    标签: c# unity3d


    【解决方案1】:

    对于多个声音,您必须有多个AudioSource,将AudioClip分配给它们并一个一个播放

    【讨论】:

      【解决方案2】:

      正如 Hamza Hasan 所说,您需要拥有多个 Audiosource 并将 Audioclip 分配给所有这些。不可能让一个音频源同时播放多个不同的剪辑,因为它一次只能链接一个剪辑。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-09
        • 1970-01-01
        相关资源
        最近更新 更多