名前の混同を避ける
private void Start()
{
var nameLabel = GetComponent<TextMesh>();
if (nameLabel == null) return;
nameLabel.text = "HOGE";
//if (photonView == null) return;
// プレイヤー名とプレイヤーIDを表示する
nameLabel.text = $"{photonView.Owner.NickName}({photonView.OwnerActorNr})";
}
PhotonViewの取得
PhotonView photonView = PunExtensions.GetPhotonView(obj);
photonView.Owner.NickName = "tiger";
VPAD
public class VPAD : MonoBehaviour
{
public FixedJoystick joystick;
public ButtonState buttonA;
public ButtonState buttonB;
GameObject m_self;
void Update()
{
Vector3 t_pos = Vector3.zero;
var sc = this.GetComponent<ExitGames.Demos.DemoPunVoice.CharacterInstantiation>();
if (sc) m_self = sc.m_self;
if (m_self == null) return;
float val = 0.02f;
if (joystick.Horizontal > 0.5f)
{
t_pos.x = val;
}
if (joystick.Horizontal < -0.5f)
{
t_pos.x = -val;
}
if (joystick.Vertical > 0.5f)
{
t_pos.z = val;
}
if (joystick.Vertical < -0.5f)
{
t_pos.z = -val;
}
m_self.transform.position += t_pos;
}
}
ハウリング
PUN生成するOBJにSpeakerつけるとハウリングノイズがなくなる(ような気がする)
Recorderマイクタイプ
Recorder.MicrophoneType Unity or Photon デフォルトは[Unity]
Phothonの場合は次のコードでリストアップできる。
‘‘‘
var enumerator = Recorder.PhotonMicrophoneEnumerator;
if (enumerator.IsSupported)
{
for (int i = 0; i < enumerator.Count; i++)
{
Debug.LogFormat("PhotonMicrophone Index={0} ID={1} Name={2}", i, enumerator.IDAtIndex(i),
enumerator.NameAtIndex(i));
}
}
‘‘‘
Recorder.VoiceDetectionThreshold
VoiceDetectionThresholdのデフォルト値は0,01です。 これは、ボイス検出キャリブレーションとノイズレベル測定を使った実験の結果として、一般的な環境に推奨される値です。
AudioSource
3D Sound Settings
MinDistance
MaxDistance