Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Bug SpriteShapeController is not rendered, generated, collider, if Camera is not looking at it.

Discussion in '2019.3 Beta' started by Discipol, Sep 29, 2019.

  1. Discipol

    Discipol

    Joined:
    May 6, 2015
    Posts:
    83
    Steps to reproduce:
    0. Open Unity and make a GameObject at 0,0.
    1. Move/drag your view from the Scene View away from 0,0.
    2. Create a SpriteShapeController inside and put some fake points via Debug (since you can't interact with it).
    3. Play the game.
    4. Move/drag your view from wherever you are, to 0,0.
    5. The SpriteShapeController will pop into existence as soon as the Camera has 0,0 in sights.

    Reason: OnWillRenderObject() has a lot of logic behind it that is ONLY triggered if at least one Camera is looking at it, which triggers OnWillRenderObject().

    I have tried to call each and every public function and doing Complete() if I get a JobHandler returned but nothing works.

    I have tried to make a new method inside (which I have to re-copy/paste each time the packages are refreshed but it would be ok) and copy/paste some logic but either nothing works, or I get a lot of NativeArray disposal exceptions thrown.

    The reason I need this is because I am using it to build a huge 2D racing track (of several lanes in perspective) that are all SpriteShapeControllers. Because they are generated procedurally at Scene load and don't exist, and my Camera is somewhere else, they don't get triggered to be built and my preloader hangs infinitely.

    What would work for me is a way to force them to be rendered / mesh built / collider created/populated with points, so I can spawn physics based objects to rest on them.

    I would take a hack too :)