PhotonNetwork.Instantiate C# (CSharp) Method

Instantiate() public static method

Instantiate a prefab over the network. This prefab needs to be located in the root of a "Resources" folder.
Instead of using prefabs in the Resources folder, you can manually Instantiate and assign PhotonViews. See doc.
public static Instantiate ( string prefabName, Vector3 position, Quaternion rotation, int group ) : GameObject
prefabName string Name of the prefab to instantiate.
position Vector3 Position Vector3 to apply on instantiation.
rotation Quaternion Rotation Quaternion to apply on instantiation.
group int The group for this PhotonView.
return GameObject
    public static GameObject Instantiate(string prefabName, Vector3 position, Quaternion rotation, int group)
    {
        return Instantiate(prefabName, position, rotation, @group, null);
    }

Same methods

PhotonNetwork::Instantiate ( string prefabName, Vector3 position, Quaternion rotation, int group, object data ) : GameObject

Usage Example

Ejemplo n.º 1
0
    private void RPC_CreatePlayer()
    {
        GameObject obj = PhotonNetwork.Instantiate(Path.Combine("Prefabs", "PlayerSoul"), CanvasGameButton.Instance.spawner1[joinRoomNum - 1].transform.position, Quaternion.identity, 0);

        CurrentPlayer = obj.GetComponent <PlayerMovement> ();
    }
All Usage Examples Of PhotonNetwork::Instantiate