The type or namespace name 'PhotonView' could not be found
The whole answer can be found below.
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).
The type or namespace name 'PhotonView' could not be found
Babbacorn
2021-10-25 09:13:22
Hi,
Getting this error trying to add "Using Photon.Pun" , I don't get any IntelliSense either for it
Error CS0246 The type or namespace name 'PhotonView' could not be found (are you missing a using directive or an assembly reference?)
any ideas?
Comments
[Deleted User]
2021-10-25 09:26:06
Try regenerating all the solution files in the Unity Editor. Edit -> Preferences -> External tools -> Regenerate Project Files. Make sure you click "reload all" when Visual Studio prompts you after regeneration. If that doesn't work, try reimporting PUN.
Hi, thanks for the response. Unfortunately, that didn't solve the issue.
[Deleted User]
2021-10-25 13:30:20
If this is part of a different assembly, you could add "Assembly-CSharp" as a project reference to your "MoreMountains" project. That should include all of the source files that Photon comes with. To add a project reference, right click "References" below your project and add it there. @Babbacorn
@MeepPun
Thanks for all of your input today but we don't seem to be able to add a reference to it. If you right-click on "References" you don't get that option - see below.
[Deleted User]
2021-10-25 14:40:20
Hi, sorry for this frustrating error you're experiencing, you may have to create a class library then, I've never personally had to deal with using Photon code in a different project before. If you were using a class library then you could theoretically reference the project normally. One of the Photonians can probably give better input, but I don't think they intended for the PUN code to be used outside of Assembly-CSharp either perhaps?
This sort of issue seems to be caused by some versions of Unity. The import and or the project generation is borked and all kinds of references will be missing.
In the package manager, you'll also find a Visual Studio integration package. That could possibly use an update.
The Unity Asset Store cache on the local machine also got "blocked" in some cases and Unity didn't ever download and import the latest versions anymore.
Back to top