FirstGearGames / FishNet

FishNet: Unity Networking Evolved.
Other
1.39k stars 149 forks source link

Scripts named "PlayerController" breaks Replicate. #793

Closed TeKGameR950 closed 1 month ago

TeKGameR950 commented 1 month ago

Important

If General, Description, and Replication are not completed the issue will be closed immediately.

General Unity version: 2022.3.49f1 (or above and prob below) Fish-Networking version: 4.4.7 and also tried 4.5.0 Discord link: https://discord.com/channels/424284635074134018/1034477094731784302/1293918580680822795 ** Above, post a link from our Discord where you troubleshot the issue (on Discord click the three dots next to the message, then Copy Message Link). Issue may be closed out if this is not included.

Description Naming a script "PlayerController" breaks Replicate, the server always receive default data. Yeah i know this is weird, but i tried it on a blank project with just FishNet, example on the WinterBolt tutorial https://www.youtube.com/watch?v=2dHUueOynxI If you take his project and rename the player script to PlayerController it breaks without notices if its intended.

Renaming the script "PPlayerController" so just a P before works, so its very weird. Neither Unity or FishNet seems to have a file/class called like so, so i suppose it is a serialization issue maybe with this specific name ?

Replication Steps to reproduce the behavior:

  1. Download the Winterbolt prediction tutorial https://www.youtube.com/watch?v=2dHUueOynxI
  2. Rename PredicatedCharacterController.cs to PlayerController.cs
  3. Rename the class name from PredicatedCharacterController to PlayerController.
  4. Launch the server and connect a client, others won't see others moving.

Expected behavior If its a known behaviour we should have a notice somewhere about naming a script so but i doubt this is intended behaviour.

FirstGearGames commented 1 month ago

As you describe it, this sounds like a Unity bug. The codegen or compile process is not picking up the file 'PlayerController.cs'. I'd recommend either just going with renaming the file, or clearing all of your library cache, temp files, and what not related to that project.

Since this sounds like a learning project, personally I'd opt for just renaming the file. There's a fair chance a few days later you'll be able to rename it back (again, Unity quirks).

Closing this out as a Unity bug but feel free to post updates here if something changes.