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

Possible issue with coroutines global settings #1733

Open
eproca opened this issue Dec 2, 2020 · 5 comments
Open

Possible issue with coroutines global settings #1733

eproca opened this issue Dec 2, 2020 · 5 comments
Assignees
Labels

Comments

@eproca
Copy link

eproca commented Dec 2, 2020

Unity version: 2018.4.17
Mapbox SDK version: 2.1.1

It seems that the inspector settings in "MAP LAYER" / "Enable coroutines" are ignored. After checking VectorLayerVisualizer it looks like that _performanceOptions is related to each specific sublayer feature, not to a global setting. If in code I get the sublayer feature and use performanceOptions.isEnabled and performanceOptions.entityPerCoroutine, everything works as expected.

This has been tested in play mode in editor, not with "Enable Preview" in editor.

@brnkhy brnkhy added the bug label Dec 5, 2020
@brnkhy brnkhy self-assigned this Dec 5, 2020
@Markovicho
Copy link

@eproca Good to know i was as well wondering why my changes regarding this options are not taking measurable effects.

If you could share your hotfix to access the features and manipulate the options at runtime would be great for other users facing this issue until a patch from the framework is available :-) Would really appreciate that

@eproca
Copy link
Author

eproca commented Jan 11, 2021

hi @Markovicho ,

If your instance of AbstractMap is absMap, your layer is called "Buildings1" and your number of entities by courutine is entitiesByCoroutine, you can simply do:
buildingsFeature1 = absMap.VectorData.FindFeatureSubLayerWithName("Buildings1");
buildingsFeature1.performanceOptions.isEnabled = true;
buildingsFeature1.performanceOptions.entityPerCoroutine = entitiesByCoroutine;

I set this before (re) initialize absMap and (re) set active buildingsFeature1.

@brnkhy
Copy link
Contributor

brnkhy commented Jan 12, 2021

Hey @Markovicho, @eproca
Nice find here! I created a quick fix which removes the coroutine setting under vector layer itself (that isn't necessary right?) and creates one under the layers. You can find it here; #1748

@Markovicho
Copy link

Markovicho commented Mar 5, 2021

@brnkhy by the way i have one general question to the coroutine setting:

For me it's not really clear why i should manipulate this parameter. From my understanding coroutines is not equal to threading as the operations will still run on main-thread. So there is no performance advantage in calling coroutines instead of synchronous running code in this case. Maybe the parameter is used to decide if a maximum number of layers are loaded parallel or incremental (?)

@brnkhy
Copy link
Contributor

brnkhy commented Mar 5, 2021

@Markovicho the only purpose of coroutines there is not to block the UI so you can move around etc without freezes while meshes are being generated but I'm afraid they are not enough when there are too many complex objects.
I'm working on a thread solution these days but again, even with a thread, the goal is not the performance but just not to block UI thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants