Skip to content

Assertion in CoroutinesSupport.cs:91 #220

@Nelvin

Description

@Nelvin

Hi Kyrylo,

I stumbled over an Assertion in PrimeTween but I fear it's a really rare edge case and I'm not sure, I can offer enough information to get an idea what happens.

So, when loading a save in the given project, a new scene will be loaded and one script creates a coroutine during it's Start method.
This coroutine spawns another one and that one, then, creates a tween.
If this tween does have a very small duration (0.001f) and is yield returned using ToYieldInstruction() this triggers the assertion - but only in an actual build and not within the Unity IDE.

Simplified code ... this is what happens

class GridManager
{
    void Start()
    {
        ...
        StartCoroutine(LevelManager.instance._StartRound());
        ...
    }
}

class LevelManager
{
    IEnumerator _StartRound()
    {
        ...
        StartCoroutine(ShowRoundPanel());
        ...
    }
    
    IEnumerator ShowRoundPanel()
    {
        yield return Tween.Custom(startValue: 1, endValue: 2, duration: 0.001f).ToYieldInstruction()
    }
}

The assertion doesn't trigger if the duration is bigger or if I add at least a single WaitForEndOfFrame in either of the two nested, parent coroutines or between the creation of the tween and the ToYieldInstruction().

Sadly, I couldn't create an easy setup where this is easy reproducible :/
I can't send the game/project - but attached is the logfile where the assertion and the callstacks can be seen.

I know this is not a lot of info, probably of no help - but I tried for quite some time (due to me having to create a build for each iteration) and the above is where I'm ended at :/

It's not a big issue as I'll just use a workaround - but maybe you have an idea what's going on.

Edit:
Noticed that changing from ToYieldInstruction() to a manual isAlive loop also results in the assertion going away, i.e.

class LevelManager
{
    IEnumerator ShowRoundPanel()
    {
        var tween = Tween.Custom(startValue: 1, endValue: 2, duration: 0.001f);
        while (tween.isAlive)
        {
            yield return new WaitForEndOfFrame();
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions