On Scene Loaded : Gameobjects positions set to TSVector.zero

Options
I don't know why and it's really annoying : the GameObjects with TSTranform, even the ones already in the scene and not spawned, are all positioned at TSVector.zero when the scene is loaded.

It is a know problem ?
Is there something I can do ?

Thx!

Comments

  • KIKS007
    Options
    It seems to be the case only with GameObjects that have the TSRigidbody ; but in another project the bug doesn't occur ! Weird !
    Sorry to spam the forum ^^
  • JeffersonHenrique
    Options
    Hello @KIKS007, feel free to solve your doubts :). I think it could be a known problem with prefab serialization, if you duplicate prefabs in the scene with TSTransform they didn't serialize well, you have to click "Reset" on the inspector panel (at the TSTransform component).
  • KIKS007
    Options
    Ok I will try that and tell you !
  • ScriptGeek
    edited February 2017
    Options
    @JeffersonHenrique I'm having the same problem and I tried what you suggested. As a test I used the TrueSync Capsule prefab, placed it in the scene at a non-zero position [anywhere other than (0,0,0)], ran the project and the capsule appeared at zero. Then I tried resetting the TSTransform as you mentioned and ran the project again, but this time the position remained where I put it in the scene. Then I created a separate gameObject in scene, added a TSTransform, Mesh Filter and Renderer (so I can see where it is at runtime), a TSRigidbody, and a TSBoxCollider. After hitting the play button, this gameObject moves to position (0,0,0) upon start. I removed the TSRigidbody component and tried running again, but this time the gameObject remained in its position. I re-added the TSRigidbody and tried running again, but this time the gameObject stayed where I put it... This got me thinking about what was different about the TSRigidbodies. So I experimented, I selected some checkboxes to Freeze Position in the Constraints property and tried running it again to discover this time the gameObject went back to zero. Unchecking all the checkboxes results in the position staying the same. Checking one or more of the checkboxes results in those axes being moved to zero. So if only the x axis was checked, the x position will be set to zero and the y and z will remain the same.

    I'm running Unity 5.5.1f and TrueSync 1.0.8

    Also, I used the Boxes demo that comes with the TrueSync package for these tests.
  • JeffersonHenrique
    Options
    Hi @ScriptGeek, thanks for your report, I will do some additional tests about those freeze properties.
  • RGKen
    Options
    Just to chime in, the issue seems to be still present in TrueSync version 1.1.0 with Unity 5.6.0.f3.
    Hitting reset on tsTransform component doesn't seem to solve the serialization issue.

    Perhaps any TrueSync developer can shed some light into the issue?
  • JeffersonHenrique
    Options
    Hi @RGKen, did you have the exact same scenario or can your add something?
  • RGKen
    RGKen
    edited April 2017
    Options
    Hi @JeffersonHenrique, I can replicate the issue without dabbling in the freeze property.

    My inkling is that this is caused by Unity not serializing `long` variable that TrueSync used in the FP struct. As a result, all changes upon hitting play from the editor will be reverted back to the original prefab value.

    Locally, I had converted the `long` variable into a string during serialization so that Unity is properly able to store the value and deserialize it back to the original `long` during load and it seems to be a good workaround right now. Though, it does require me to mess around with the FP class.