The type or namespace name 'RoomInfo' could not be found

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

The type or namespace name 'RoomInfo' could not be found

Lethn
2019-01-21 03:58:45

Since I had bought PUN beforehand I decided to go ahead and upgrade to PUN 2 to see if that would help with network smoothing and so on at all. I got a bunch of assembly reference errors that I managed to fix myself but for some reason a RoomInfo one still stays,

error CS0246: The type or namespace name 'RoomInfo' could not be found (are you missing a using directive or an assembly reference?)

Is there a using somethingorother that I've missed specifically for rooms now?

Comments

JohnTube
2019-01-21 11:18:32

Hi @Lethn,

Thank you for choosing Photon!

RoomInfo is now part of Photon.Realtime namespace, you either add
using Photon.Realtime; on top
or
use Photon.Realtime.RoomInfo.

We will add this to the "Migration Notes".

Lethn
2019-01-21 14:28:05

Thank you! Now I'll get to experiment more with network smoothing and see if PUN 2 makes any difference to the movement etc.

Lethn
2019-01-21 14:36:13

Scratch that, I spoke to soon, I've got three new assembly reference errors.

error CS1061: 'ServerSettings' does not contain a definition for 'JoinLobby' and no accessible extension method 'JoinLobby' accepting a first argument of type 'ServerSettings' could be found (are you missing a using directive or an assembly reference?)
error CS1061: 'ServerSettings' does not contain a definition for 'EnableLobbyStatistics' and no accessible extension method 'EnableLobbyStatistics' accepting a first argument of type 'ServerSettings' could be found (are you missing a using directive or an assembly reference?)
error CS1061: 'PhotonStream' does not contain a definition for 'isWriting' and no accessible extension method 'isWriting' accepting a first argument of type 'PhotonStream' could be found (are you missing a using directive or an assembly reference?)

JohnTube
2019-01-21 15:04:04

Hi @Lethn,

Remove PUN Classic first then import PUN2.

Lethn
2019-01-21 15:19:04

There shouldn't be any trace of PUN classic as I deleted the Photon folder before importing.

JohnTube
2019-01-21 16:17:36

Then follow "Migration Notes".

  • AutoJoinLobby is removed
  • ServerSettings.EnableLobbyStatistics is moved to ServerSettings.AppSettings.EnableLobbyStatistics
  • isWriting is renamed to IsWriting

Lethn
2019-01-21 17:06:08

Oh bloody hell, right, thanks, I'll check these out and report back if it's all working.

Lethn
2019-01-21 17:17:44

Okay, I'm working through the errors now, it just looks like I need to change the code to match the changes in the migration notes like you say, thanks for the help.

Lethn
2019-01-21 22:41:34

Okay, I've managed to whittle down my errors to about 5 now, one thing that's causing me a huge number of problems is

ILobbyCallbacks.OnRoomListUpdate(List < RoomInfo > roomList);

I get the following errors:

error CS0305: Using the generic type 'List' requires 1 type arguments
error CS0119: 'RoomInfo' is a type, which is not valid in the given context

Here's a code snippet of what I'm trying to do.

createdRooms = ILobbyCallbacks.OnRoomListUpdate( List roomList );

JohnTube
2019-01-22 10:10:08

Hi @Lethn,

I think you misunderstood how you should use interfaces and callbacks.
OnRoomListUpdate does not return anything, it will be called when the server sends the client lobby rooms list updates. Take a look at examples in PUN2 demos to see how it works. Also, you may want to learn more about C# interfaces and how to implement them, also how to extend classes and override methods, etc.

As a start, I suggest that your classes extend MonoBehaviourPunCallbacks instead of MonoBehaviour (or old PUN1 Photon.PunBehaviour or Photon.MonoBehaviour.) then override the callbacks you need.

Lethn
2019-02-04 19:01:38

Hi, sorry, major necro/bump I know I should have absolutely written up a response earlier, in regards to interfaces I was doing research a lot on how to make a decent room browser and it was awhile back that I came across this write up which was working absolutely fine in PUN 1 and I was just following along with the migration notes to try and fix things.

https://sharpcoderr.com/blog/photon-network-beginners-guide

Oh and lol this is so typical, I just found the demo example you were talking about PUN Cockpit, I'll check this out and see if I can't use that demo to fix things, it should all work as it all seems to be up to date so that's nice. I had the flu most of January so I wasn't doing very well keeping on top of things.

public void OnRoomListUpdate(List roomList)

    {

    }</code>

That's why it wouldn't work -_- looks like I'm going to have to work using the demo as my resource rather than the PUN 1 tutorial which explains a lot.

JohnTube
2019-02-04 19:58:43

Hi @Lethn,

You can find a good snippet of how to implement OnRoomListUpdate here, read my last comment after that also.

Lethn
2019-02-04 21:42:46

Thanks @JohnTube! I'll check it out.

superbbros
2020-12-05 13:05:44

@JohnTube Thank you I was having the same problem!

Back to top