Changing a ViewID while it's in use is not possible (except setting it to 0(not being used).

Somosky

New member
So I've used UCC and the Pun 2 addon before and have never had this issue.

First of all the demo scene works fine. So there's certainly nothing wrong with the asset in general.

However I've created several different characters to test this out with and they all give the same error message.

"Changing a ViewID while it's in use is not possible (except setting it to 0(not being used)."

I've created the characters in the normal way to set up characters. Then I have added them to the addon screen and set them up for pun. Then created them as prefabs and set them into the pun game object to be instantiated. However I get this error message every time. Even if I bring my character into the demo scene and add it into the pun game object it still doesn't work.

It seems to be a issue of the characters photon view not changing when it is instatiated. For example in the prefab screen the photon view says "Set at Runtime" however if I drag the prefab into the scene it states a number (example :300). So when the player in created that 300 number does not change and that's where I am getting my error.

In the editor console it's pointing to SpawnManagerBase cs 144 and SpawnManagerBase cs 95.

I know that Nolan is working in the demo scene but could someone try converting another character to a pun character for a test because I'm wondering if something isn't working correctly with the editor window for creation.

Also I'm on Unity 2020.3.1f1 LTS.
 

Justin

Administrator
Staff member
If you replace your character prefab with the Nolan prefab does it work? Also, are you running the most recent version of the add-on and PUN?
 

Somosky

New member
Yes the Nolan prefab works fine. I have the most recent version of both Pun and the Pun addon.

If I create a new character using the normal set up wizard. Then use the addon section to set it up as a Pun character. Save the prefab. Then set that character to spawn.

That's when I get the error.

Like I said the issue is that the Photonview # isn't being allowed to change at runtime for whatever reason. Where you able to create another character that wasn't Nolan through the setup wizard?
 

Somosky

New member
I've created a short video to show you what I'm talking about. Sometimes I'm not the best at explaining haha

 

Justin

Administrator
Staff member
I did test creating a new character successfully, though I can't see where you are going wrong in your video. What is the call stack of that warning?

If you compare the PUN components on Nolan versus your own character do you notice anything different?
 

frut

New member
I have the same error happening. It started to appear when I added a new weapon to my character.
I think this is due to the last update. I could do everything right before.
 

Somosky

New member
The warning gives these two details stating here is where the issue is SpawnManagerBase cs 144 and SpawnManagerBase cs 95.

I've taken both a created character and Nolan and compared the prefabs. I didn't notice anything different between the two.
 

Somosky

New member
So I just got home. I tested this out in a clean project on 2020 LTS and 2019 LTS. The only assets installed are the ones necessary for me to test pun and the pun addon. I'm getting the same error messages in the clean installs.

I even tried to redownload both the ucc and pun addon from your website just incase I was mistaken and was out of date however the issue still happens.

The last thing I tried was taking Nolan from the regualar demo scene and turning him into a pun character using the wizard and the nolan character did not work and was having the same issues. I'm really not sure what else to try.

I've tried Unity 2019 and 2020 LTS.
Deleted PUN from my project and downloaded the most recent version from March 15th (I believe that was the date).
Deleted and redownloaded both UCC and the UCC Pun Addon.

I'm really just out of ideas to try. You said it looked like I did the setup in the video correctly but not matter what version of Unity I use this error keeps coming back.

I also have the most recent version of the character controller. Could that be causing some issue. Is that the version that you tested or was it a older or newer version. I have the most recent one on the website which is 2.3.1

Anyway sorry to be a bother but I have literally tried everything I can think of.
 

BJPickles

Member
Can confirm this is happening to me as well. I made 30 characters that work absolutely fine in UTPM about 4 months ago. (This was when I sent you that bug about sheathing Justin)

Waited for the fix to come out (I think it was 2.2?)

Deleted UTPM and PUN from project, then imported TPC (as I had upgraded).

Now every time I create a character, I get a viewID issue and it sometimes says I have no look source.

1617990212573.png


Furthermore remote players cannot connect to a host client when remote character's viewID is trying to be changed. The character doesn't initiate.

If host's viewID is trying to change, remote clients join a new instance.
 

Justin

Administrator
Staff member
Thanks for sending the project. You can fix this error by first resetting the Photon View ID on line 144 of SpawnManagerBase:

Code:
            var photonView = player.GetComponent<PhotonView>();
            photonView.ViewID = 0; // NEW
            photonView.ViewID = PhotonNetwork.AllocateViewID(newPlayer.ActorNumber);

I plan on doing a release this soon and will also have it fixed.
 

BJPickles

Member
Thanks for sending the project. You can fix this error by first resetting the Photon View ID on line 144 of SpawnManagerBase:

Code:
            var photonView = player.GetComponent<PhotonView>();
            photonView.ViewID = 0; // NEW
            photonView.ViewID = PhotonNetwork.AllocateViewID(newPlayer.ActorNumber);

I plan on doing a release this soon and will also have it fixed.

This initially worked without any errors! Big thanks for the super fast fix!

However after I added my runtime pickups, I've got the same error:

I just changed the ID to 8 (as there were 7 weapon), but these were set by the scene setup tool. Thought I'd point it out just in case
 
Last edited:

Somosky

New member
Thanks for sending the project. You can fix this error by first resetting the Photon View ID on line 144 of SpawnManagerBase:

Code:
            var photonView = player.GetComponent<PhotonView>();
            photonView.ViewID = 0; // NEW
            photonView.ViewID = PhotonNetwork.AllocateViewID(newPlayer.ActorNumber);

I plan on doing a release this soon and will also have it fixed.
Cool I'll take a look at it when I get home. I appreciate you going above and beyond to look into this for me.
 

Somosky

New member
Thanks for sending the project. You can fix this error by first resetting the Photon View ID on line 144 of SpawnManagerBase:

Code:
            var photonView = player.GetComponent<PhotonView>();
            photonView.ViewID = 0; // NEW
            photonView.ViewID = PhotonNetwork.AllocateViewID(newPlayer.ActorNumber);

I plan on doing a release this soon and will also have it fixed.
So I tried this out and it definitely gets rid of the error. However when you build the game and try to have characters join to the game it deletes both the host and the second player. I'm guessing the photonview is somehow being set to the same thing for the host and the client.
 

Justin

Administrator
Staff member
I found the root of the issue. When you add the character to the scene when initially creating it PUN is now setting the scene ID. This scene ID gets transferred to the ViewID and causes all sorts of issues. I have this fixed in the update going out today.
 
Top