ネットワーク上で各プレーヤーの出現位置をランダム化する






各プレーヤーをランダムな位置から出現させる
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class RoomManager : MonoBehaviourPunCallbacks
{
// ★追加
public GameObject[] spots;
void Start()
{
// ★変更(どのスポットから出現するかはランダムにする)
PhotonNetwork.Instantiate("Player", spots[Random.Range(0, spots.Length)].transform.position, Quaternion.identity);
}
}



【2020版】BattleOnline(基礎/全34回)
他のコースを見る





各プレーヤーをランダムな位置から出現させる
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class RoomManager : MonoBehaviourPunCallbacks
{
// ★追加
public GameObject[] spots;
void Start()
{
// ★変更(どのスポットから出現するかはランダムにする)
PhotonNetwork.Instantiate("Player", spots[Random.Range(0, spots.Length)].transform.position, Quaternion.identity);
}
}



ネットワーク上で各プレーヤーの出現位置をランダム化する