Skip to content

JBehaviour Loop Failed #511

Description

@manbaaa

在热更方法 RunGame 里动态创建JBehaviour,最开始创建的前几个的Loop方法不会执行。

需要打包环境测试,在JBehaviour.cs里屏蔽掉如下代码:

//编辑器下可视化
if (Application.isEditor)
{
var id = AddClassBind(gameObject, activeAfter, typeof(T));
var ret = (T)JBehaviours[id];
ret.Check();
return ret;
}

可以在Unity编辑器下重现,前提是FpsMonitor里的_backupFrames初始化为0;

Activity

  1. manbaaa commented on Jun 11, 2024

    @manbaaa
    ContributorAuthor

    public JBehaviour Activate()
    {
    //主线程
    ThreadMgr.QueueOnMainThread(() =>
    {
    Awake();
    var duration = 1f / ((float)Application.targetFrameRate <= 0
    ? FpsMonitor.FPS
    : Application.targetFrameRate);
    duration = duration / TimeScale;
    ThreadMgr.QueueOnMainThread(() =>
    {
    OnEnable();
    Start();
    }, duration);
    });
    return this;
    }

    测试下来是因为在 JBehaviour 执行 Activate是 FpsMonitor.FPS值为0,导致duration值很大。

  2. github-actions commented on Jan 28, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity.
    It will be closed in 14 days if no further activity occurs.
    If this issue is still relevant, please comment or remove the stale label.

  3. github-actions commented on Apr 8, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity.
    It will be closed in 14 days if no further activity occurs.
    If this issue is still relevant, please comment or remove the stale label.

  4. github-actions commented on Apr 22, 2026

    @github-actions

    This issue was closed due to inactivity. Feel free to reopen if still relevant.

  5. github-actions commented on Jun 22, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity.
    It will be closed in 14 days if no further activity occurs.
    If this issue is still relevant, please comment or remove the stale label.

  6. github-actions commented on Aug 23, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity.
    It will be closed in 14 days if no further activity occurs.
    If this issue is still relevant, please comment or remove the stale label.

  7. github-actions commented on Sep 6, 2026

    @github-actions

    This issue was closed due to inactivity. Feel free to reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions