- Home /
Question by
nordaj123 · Oct 08, 2015 at 01:43 AM ·
c#networkingnetworkspawningmatchmaking
How can i spawn my player in matchmaker using my UI?
I have been trying to fugure out how i can make my own UI for matchmaker for a while now. I have been kind of successfull, I was able to create the internet match the only problem was that when i do so my player prefab does not spawn. I did assing a prefrab to the networkmanager and that prefab has the components it needs but since i wanted to use my own UI i probably made a mistake or did things the hard way. Here is my C# Code:
using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
using UnityEngine.UI;
using UnityEngine.Networking.Types;
using UnityEngine.Networking.Match;
public class Manage : NetworkManager
{
public Text inp;
NetworkMatch networkMatch;
void Awake()
{
networkMatch = gameObject.AddComponent<NetworkMatch>();
}
// Use this for initialization
public void StartGame ()
{
CreateMatchRequest create = new CreateMatchRequest();
create.name = inp.text;
create.size = 2;
create.advertise = true;
create.password = "";
networkMatch.CreateMatch(create, OnMatchCreate);
}
// Update is called once per frame
public void JoinGame ()
{
}
}
This is my code that was used. My question is, When i create my match in the function "StartGame" do i need to add code to spawn the objects or am i doing things the hard way?
Comment