Unable to call Photon.PunBehaviour

Options
So I'm trying to make the FPSController that comes in the Standard Assets package work with PUN... However, I'm having a slight issue with this. It simply won't recognize anything Photon. It throws this error when I try to call it:
Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/FirstPersonController.cs(11,53): error CS0234: The type or namespace name `PunBehaviour' does not exist in the namespace `Photon'. Are you missing an assembly reference?


I wondered if it had anything to do with the namespace they gave the script. I removed it and that didn't change anything at all.

Here's a picture of the script, along with the project setup on the left just in case something's wrong there:




Comments

  • Hi @lightpower26,

    you get this issue because of Unity's script compile order. When the FirstPersonController script gets compiled the PhotonClasses script - which contains PunBehaviour - isn't ready so you can't use it. Since 'Standard Assets' is a special folder name, the easiest way to fix this might be to rename it to something else, e.g. 'Standard Assets Renamed'. This sadly results in some disadvantages (e.g. Updating the package, I don't know how often this gets updated) but is an easy workaround for now.

    You can read more about Unity's script compile order on their API.

    Maybe someone else provides a better solution.