Error of arguments in Unity Photon

Asked

Viewed 96 times

0

I was developing an online project and I cited the following function - PhotonNetwork.CreateRoom, and the following error occurred to me:

Assets/Scripts/Sindico.Cs(53,31): error CS1501: No Overload for method CreateRoom takes 0 Arguments

You’re asking for 4 arguments:

  • 1° Argument - string roomName
  • 2° Argument - RoomOptions roomOptions
  • 3° Argument - TypeLobby typeLobby
  • 4° Argument - Ainda nao sei!

How to solve this problem?

  • 1

    Show your code from CreateRoom, is just [Dit] the question to add that. Looking this article I see that the function takes 3 arguments (but C# is not my thing...)

  • I’ll see if it works

1 answer

0

It’s been a long time since you asked the question, but if anyone still has that question, you can consult the answer.

First, you have to keep in mind that to create a room in Photon you need to be connected in the Lobby. If this has been done, you will then need to run the Photonnetwork.Createroom method().

The error you get is because the method does not have a constructor that accepts your instantiation without method. And in fact, it does not need 4 arguments, you can create with only one: the name of the room

Ex: Photonnetwork.Createroom("minha_sala");

Remembering that it automatically connects to the room when you create it. To find out if everything went well, you can use this method:

void OnJoinedRoom(){
    Debug.Log("Entrei na sala com sucesso!");
}

If you still have doubts, take a look at this video that covers the entire lobby:

https://www.youtube.com/watch?v=VJg24zvd_8o

I hope I helped. Hugs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.