Namespace errors when importing Photon Voice

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 Voice.

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.

Namespace errors when importing Photon Voice

JonDadley
2016-07-08 19:44:55

I have an existing PUN+ project I want to integrate Photon Voice into. However, when I import the Photon Voice asset I get the following 4 errors:

"Assets/Photon Unity Networking/Demos/PunBasics-Tutorial/Scripts/GameManager.cs(25,43): error CS0234: The type or namespace name MonoBehaviour' does not exist in the namespace ExitGames.Photon'. Are you missing an assembly reference?

Assets/Photon Unity Networking/Demos/PunBasics-Tutorial/Scripts/Launcher.cs(25,40): error CS0234: The type or namespace name PunBehaviour' does not exist in the namespace ExitGames.Photon'. Are you missing an assembly reference?

Assets/Photon Unity Networking/Demos/PunBasics-Tutorial/Scripts/PlayerAnimatorManager.cs(17,53): error CS0234: The type or namespace name MonoBehaviour' does not exist in the namespace ExitGames.Photon'. Are you missing an assembly reference?

Assets/Photon Unity Networking/Demos/PunBasics-Tutorial/Scripts/PlayerManager.cs(22,45): error CS0234: The type or namespace name PunBehaviour' does not exist in the namespace ExitGames.Photon'. Are you missing an assembly reference?"

I tried creating a blank new project, importing PUN+ and then Photon Voice but received the same errors so it doesn't appear to be an issue with my project.

I'm on Unity 5.3.5p6. I received the same issue on p4.

Comments

vadim
2016-07-12 07:53:43

PunBasics-Tutorial is not a part of PUN. So you can't have same errors when importing PUN in blank project.
First check if PhotonVoice imported alone in blank project works for you. If yes, try merge PUN+ and PhotonVoice:

  • import PUN+ in blank project
  • import PhotonVoice skipping all existing files (do not override PUN+ files at this step)
  • copy (override) 4 files from full PhotonVoice installation (imported somewhere else) to PUN+ installation:
    Editor\PhotonNetwork\AccountService.cs
    Editor\PhotonNetwork\PhotonEditor.cs
    Editor\PhotonNetwork\ServerSettingsInspector.cs
    Plugins\PhotonNetwork\ServerSettings.cs

RKeown3D
2016-08-01 18:59:58

I'm able to re-create this with both PUN and PUN+. The recommended fix doesn't actually appear to work. Any updates on this?

RKeown3D
2016-08-01 19:20:12

Ok, there's actually 2 things going on here. The first is that there is a namspace conflict with thall scripts under under PUNVoice/DemoVoice/Scripts. their namespace is defined as ExitGames.Photon.DemoPunVoice. The problem is that the Photon is a PArent level namsepace entry (Defined in Photon Unity Networking/Plugins/PhotonNetwork/Photonclasses.cs), on its own, as well as being a sub-namespace entry under the ExitGames parent level namespace.

the simple fix is to change all of the scripts namespace properties under PUNVoice/DeomVoice/Scripts to the following:

namespace ExitGames.Demos.PunVoiceDemo

from

namespace ExitGames.Photon.PunVoiceDemo

Save all of the scripts, and re-build the project.

A second issue found is with the enum of PeerState, being renamed to ClientState. Replace all instances of PeerState. to ClientState.

The project should now fully compile, and all included demos should work.

JohnTube
2016-08-03 17:27:03

Hi @RKeown3D,

Thank you for your reports and suggested fix. We will look into it.

RKeown3D
2016-08-04 19:54:01

Anytime!!!!

jay
2016-08-06 15:05:04

I am not sure how to fix the problem but when I created a brand new project and only imported the Photon Voice package, everything seemed to work fine. I think the problem is that I tried to import the Photon Voice package into a project that already had Photon Unity Networking Package. I do not think that these two packages are playing nice with one another.

I hope this gets fixed soon. I would really like to have voice chat in my game!

jeanfabre
2016-08-11 12:34:49

Hi,

The problem has been addressed and will be available in the next update of Photon Voice. Meanwhile you can simply delete the pun voice demo to work.

Thanks,

Jean

Back to top