Search Unity

Third Party "Photon Instantiate" spawns at "0,0,0" on certain computers abroad. (Offline mode)

Discussion in 'Multiplayer' started by MateChar, Nov 4, 2022.

  1. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14
    Hello,


    I've recently released a demo of my game, and it was released as "offline" for PUN.

    It seems the game works fine on most PCs, however, I've got messages from several users that the game is broken.

    Below is one of the videos describing the issue:


    If you watch it, you may see that the issue is related to the wrong spawning of objects: "Photon Instantiate" spawns things at the origin of the world which is "0,0,0". (I used Photon Instantiate for every spawning of scene objects including the player.)

    To describe this in detail, objects get spawned at the stored position inside the prefabs.

    I have read a few posts dealing with a similar problem but they were all done under "online" mode. Mine is "offline"...!

    I have spent days trying to fix this bug but haven't yet come up with any clue. (The game worked for most of the PCs! But certain computers other than my country showed this issue.)

    If anyone can help with this issue, I'll put your name on our game's special thanks list!


    Have a wonderful day for everyone reading this thread :)
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    I would expect that PN.Instantiate() places the objects at the position you pass into Instantiate. Maybe it's 0,0,0 in those cases?
    If you can provide some way to reproduce it, we can look into this. Or logs from the clients?
    Reach us via mail: developer@photonengine.com to provide whatever insight you have. Machines "in other countries" is usually not a problem.
     
    MateChar likes this.
  3. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14
    Thank you for the kind reply! I'll send you our demo to the address:)

    (Unfortunately, my demo users from my country and I couldn't reproduce the same problem, but a few users abroad could.)
     
  4. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14

    Hello, Tobias!

    Hope everything is well with you.

    I recently got a log file from one of the clients experiencing the issue, and I am attaching it here.

    The lines that I found suspicious were these:

    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/PhotonCryptoPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/PhotonCryptoPlugin.dll
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/PhotonCryptoPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/libPhotonCryptoPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/libPhotonCryptoPlugin.dll
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/libPhotonCryptoPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/PhotonSocketPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/PhotonSocketPlugin.dll
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/PhotonSocketPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/libPhotonSocketPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/libPhotonSocketPlugin.dll
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/libPhotonSocketPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/PhotonEncryptorPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/PhotonEncryptorPlugin.dll
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/PhotonEncryptorPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/libPhotonEncryptorPlugin
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/libPhotonEncryptorPlugin.dll
    Fallback handler could not load library D:/GAMES/THE_HIGHRISE_3.6.2.2 DEMO_Dev(Log Available)/The Highrise_Data/Mono/libPhotonEncryptorPlugin

    Would you take a look at the log?


    And for anyone other than Tobias, would you let me know if you find any issue inside the log, too?

    Wish you all a great day :)
     

    Attached Files:

  5. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    The part you quoted is harmless, actually. It is the attempt to load a native plugin for our lib. The code is fine with it not being present and falls back to a managed implementation. No harm done by this.
    It is actually a bug in Unity to even log this at all (and it's annoying because it does look like an issue).

    I don't see Photon related problems in the log.

    I wonder what "Uploading Crash Report" means exactly and if there is a way to access it?

    This looks as if it could cause issues with string encoding:
    Code (CSharp):
    1. <color=#0099bc><b>DOTWEEN â–º </b></color>Target or field is missing/null () â–º
    Aside from that, I don't see the cause.
     
    MateChar likes this.
  6. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14

    Thanks again for analyzing the log, Tobias :)

    I have looked upon "Crash Report" but no log couldn't be found under the directory specified in the Unity documents:

    %USERPROFILE%\AppData\LocalLow\(CompanyName)\(ProjectName)\Crashes folder


    To figure out how string encoding could cause the issue, I compared the log above with the log where no bug was found.

    In conclusion, they have the identical lines that you have suggested so I believe this may not be the cause.

    But I'll definitely get rid of the string errors as much as possible, and come back if it solves the issue.


    While searching for similar cases to mine, I also found this user had experienced a similar issue:

    https://stackoverflow.com/questions...bugs-with-unity-builds-that-you-have-sent-out


    Maybe, this issue has something to do with "Playmaker"?

    I'll also change the .NET settings from Standard 2.0 to 4.x for a try.
     
    tobiass likes this.
  7. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    It could be related to Playmaker. Did you look up, if similar cases of this are known for it?
    It looks as if could still be everything. Did you build a debug build?
     
    MateChar likes this.
  8. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14

    Yes!

    This user from Stack Overflow posted a similar issue in February (2022):

    https://stackoverflow.com/questions...bugs-with-unity-builds-that-you-have-sent-out


    I've built a new one with .NET 4.x Setting and sent it to one of my users with the bug.

    (I'd like to request every one of them but only a few are responding...)

    I don't believe it would have fixed it but I'm clutching at straws right now haha :)
     
  9. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14
    After having solved the string error and other "Unsupported Type" errors, the bug is still not fixed...

    The game was reported OK by users from US and South Korea but broken from Germany, Russia, and Poland.

    :(

    I'm leaving the newest Player log(+stack traced) reports here.
     

    Attached Files:

  10. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    Player2.txt has enless repetitions of found fsm to observe : 0 logs. Then it logs a lot of fsm's it can't find.
    Is that the problem? I don't use PlayMaker, so maybe someone in their community can help?
    I don't see exceptions or such and not a lot of PUN activity. It may be the state machines are not running and thus not instantiating what you're missing...
     
    MateChar likes this.
  11. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14
    Thanks again for helping me out on this issue, Tobias :)

    found fsm to observe : 0 logs were found on the log with no bug, too, but I'll have a look on them.

    I've aslo left a post on the Playmaker forum as you suggested.

    While I'm waiting for any reply, I will be changing the "Photon Instantiate" action to the simple "Create Object" action to see whether it makes a difference...!
     

    Attached Files:

    Last edited: Nov 18, 2022
  12. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14
    Yes!

    I think I finally found the cause.

    It was "Vector3 to String" Playmaker conversion that had been misleading the positions of the player and the items.

    I've recently got a log that recorded the positions and rotations from the user with the bug:

    INTERACTION_DATABASE : REGISTRATION : SPAWN 2 : Vector3(-36,04434,361,806,-15,59866)
    INTERACTION_DATABASE : REGISTRATION : SPAWN 2 : Vector3(-7,924312E-14,129,0308,6,556271E-15)

    As you can see, the Vectors are stored with "commas" only...!

    This was not intended.


    The normal log displays the same logs as these:

    INTERACTION_DATABASE : REGISTRATION : SPAWN 2 : Vector3(-36.04434,361.806,-15.59866)
    INTERACTION_DATABASE : REGISTRATION : SPAWN 2 : Vector3(-7.924312E-14,129.0308,6.556271E-15)

    Now, I'm trying to figure out how to set the format evenly for every player...!
     
  13. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14
    I'd like to apologize for misjudging Photon as the cause at the beginning:(

    The conclusion is that ToString() format was not uniform according to different CultureInfo() Settings.


    Finally, I fixed this bug by setting the CultureInfo() as the following:

    CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;

    :)


    Specially thank you to Tobias for having helped me all along :D

    Wish you all a great weekend!
     
  14. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    No worries. I am glad you could find and work around this!
    Sneaky.
    Can I ask why and where you use ToString() on Vector3? You don't send them over the network this way, do you?
    You can include Vector3 in RPCs and OnPhotonSerializeView()...
     
    MateChar likes this.
  15. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14
    Yes:)

    ToString() was used to save the positions and rotations of the player and the items!

    I loaded the data and turned them back to vector3 to instantiate them using Photon.

    We use a 3rd party asset called "Smooth Sync" to sync real-time positions and rotations (except for the items as they barely move.) (+the asset uses Vector3 for OnPhotonSerializeView() I believe.)

    But we do turn vector3 to String quite often for RPC because we use Playmaker for this function and it only supports the "String" value to send data...

    So far, they haven't caused much trouble yet so we will try to slowly convert the Playmaker functions to custom scripts after we release Early Access...!:confused:
     
    Last edited: Nov 24, 2022
  16. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
    Oh, really? Playmaker requires you to use string in RPC?

    Thanks for the insight.
    All the best for the Early Access.
     
    MateChar likes this.
  17. MateChar

    MateChar

    Joined:
    Jul 23, 2016
    Posts:
    14
    Yes...

    Although there are a few other functions for other types, they don't work...

    (We've been using Photon Classic so we aren't sure about PUN2 with Playmaker.)


    My Pleasure :)

    Thanks a lot, Tobias;)