add the connection with the editor and can test the json now

This commit is contained in:
2025-11-03 16:12:22 +08:00
parent 98510eef0f
commit 4ebe6183d3
57 changed files with 3287 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
using UnityEngine;
public class OpAudioPlayer : MonoBehaviour
{
public AudioSource audioSource;
void Start()
{
if (audioSource == null)
{
audioSource = GetComponent<AudioSource>();
if (audioSource == null)
{
Debug.LogError("OpAudioPlayer: 找不到 AudioSource 组件。请确保组件已添加或在 Inspector 中设置。");
return;
}
}
audioSource.loop = true;
if (!audioSource.isPlaying)
{
audioSource.Play();
}
}
private void OnDestroy()
{
if (audioSource != null && audioSource.isPlaying)
{
audioSource.Stop();
}
}
}