Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating GameObject in FixedUpdate doesn't exit the FixedUpdate Interpolation context #5553

Closed
PolSpock opened this issue May 22, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@PolSpock
Copy link

PolSpock commented May 22, 2024

Describe the bug

According to this discord discussion with conna,

Currently creating a GameObject in an OnFixedUpdate() will not leave the fixed update interpolation context, creating some confusing behavior between the OnUpdate and OnFixedUpdate behavior

Let's take a look at the reproduction steps

To Reproduce

  1. Download https://github.com/PolSpock/sbox-updatefixedupdate/tree/main/code
  2. Look at NetworkTest.cs, it's the player component.
    By pressing attack1, 2 identicals gameobject will be spawned :
  • One from OnUpdate context
  • One from OnFixedUpdate context

Money.cs is just a simple GameObject with a MoneyChild child GameObject who rotating on himself & has Transform.LocalRotation = Rotation.FromPitch( 90f ); on OnAwake

  1. Starts a game, look at the log : the transform are different between the 2 gameobjectfs cause the OnFixedUpdate aren't leaving his interpolation context even if the GameObject is in his OnAwake context

This is confusing.

Expected behavior

As conna says :

it makes sense we shouldn't be interpolating values set in OnAwake etc just because we're in a fixed update context, when you are setting transform in OnAwake you'd expect it set immediately regardless

Media/Files

Reproduction steps in video:

2024-05-22.11-27-47.mp4

Additional context

No response

@PolSpock PolSpock added the bug Something isn't working label May 22, 2024
@kurozael kurozael self-assigned this May 22, 2024
@PolSpock
Copy link
Author

PolSpock commented May 22, 2024

Also, note this issue only happens if i'm spawning the Money.cs component that will spawn his ChildMoney.cs in his OnAwake func.

If I'm spawning directly ChildMoney.cs the issue does not seem to occur

weird

@kurozael
Copy link

Can you try to reproduce this when the next Steam build finishes @PolSpock ?

@PolSpock
Copy link
Author

It's good 👌 thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

3 participants