• Runtimes
  • Unity 5 seems to break my runtime [possible Bug?]

@Pharan: Oh, I know that's not merged - I just figured maybe the sorting layer stuff mentioned in that comment is also the issue here 🙂

Related Discussions
...
7 dana kasnije

Any updates on this bug?

Whenever I test the scene in Play Mode, stop and go back to Scene View (Editor Mode), my Submeshes disappear!
They only reappear after I hit Ctrl+S to save the scene or change the scene in any way (e.g. move stuff around)

Does no one else experience this bug?

5 dana kasnije

Yes, I do.
Was going to ask for a solution too

Am going to try to rework submesh system this week in general. Sorry for the trouble.

Mitch wrote

Am going to try to rework submesh system this week in general. Sorry for the trouble.

Sounds awesome 🙂 What will the changes be?

I'm going to have skeleton mesh renderer generate one mesh per pass instead of submeshes as a "render mode" that can be toggled on. Basically I'm going to do it right this time heh



In hindsight... I'd rather wait until we get someone elses efficiency tweaks into the main runtime officially before I attempt the submesh overhaul. Instead, I've done a patchjob to make Submesh behaviour a bit more consistent. unitypackage and repo updated. Video for example of how to use.

16 dana kasnije
Mitch wrote

I'm going to have skeleton mesh renderer generate one mesh per pass instead of submeshes as a "render mode" that can be toggled on. Basically I'm going to do it right this time heh


In hindsight... I'd rather wait until we get someone elses efficiency tweaks into the main runtime officially before I attempt the submesh overhaul. Instead, I've done a patchjob to make Submesh behaviour a bit more consistent. unitypackage and repo updated. Video for example of how to use.

Thanks so much, everything works now! The meshes reload! :handshake: :heart:

Yes the internal api changed.

_utilityType = Type.GetType("UnityEditorInternal.InternalEditorUtility, UnityEditor");
_sortingLayerNamesProperty = _utilityType.GetProperty("sortingLayerNames", BindingFlags.Static | BindingFlags.NonPublic);
_getSortingLayerUserIdMethod = _utilityType.GetMethod("GetSortingLayerUniqueID", BindingFlags.Static | BindingFlags.NonPublic);

Take a look where these are and compare the difference.

11 dana kasnije

UPDATE: Unfortunately, the meshes still randomly disappear.. initially the updated runtime seemed to have fixed the problem with the meshes not rebuilding after play mode but after about 1h of working on the game, they started to disappear again (after playmode testing). When I hit Save they rebuild but this is still very annoying..

Does anyone know why they are not rebuilding properly?

Sigh.... I have no idea now lol. I did a lot of redundant checking to make sure they got rebuilt... this might have to wait until after we do a big efficiency pass as well as getting the new transform pass nate's working on into the unity runtime... sorry :<

I had this same exact issue and found a workaround for the sorting layers. Basically when I upgraded to Unity 5, all of my layer IDs changed from simple values starting at 1, to crazy long numbers (my Midground layer is now ID #684989807). In the past I used a simple script to help sort some of my non 2D objects like Particle Systems called "Sorting Layer Exposed". I found it online that someone made a long time ago and it's helped me out a lot. Basically you can attach this script to any object, type the layer name in the appropriate field, and you will get the new layer ID. You can then use this ID for your sub-mesh renderers and it should work as expected. Please let me know if you have any questions and I'd be happy to post screens or something.

I am attaching the script so you can take a look and see if it works for you for now.

Best of luck!

@cparki3 for reference: https://github.com/nickgravelyn/UnityToolbag/tree/master/SortingLayer
Note that it's not updated for Unity 5 so the change from simple small ints to full sorting layer UIDs still applies as long as you're using Unity 5.

SkeletonRenderer's inspector code for sorting layers works correctly with Unity 5 though, if you're interested. See here: https://github.com/EsotericSoftware/spine-runtimes/blob/master/spine-unity/Assets/spine-unity/Editor/SkeletonRendererInspector.cs#L105

cparki3 wrote

I had this same exact issue and found a workaround for the sorting layers. Basically when I upgraded to Unity 5, all of my layer IDs changed from simple values starting at 1, to crazy long numbers (my Midground layer is now ID #684989807). In the past I used a simple script to help sort some of my non 2D objects like Particle Systems called "Sorting Layer Exposed". I found it online that someone made a long time ago and it's helped me out a lot. Basically you can attach this script to any object, type the layer name in the appropriate field, and you will get the new layer ID. You can then use this ID for your sub-mesh renderers and it should work as expected. Please let me know if you have any questions and I'd be happy to post screens or something.

I am attaching the script so you can take a look and see if it works for you for now.

Best of luck!

Thanks for the input, I actually used the same script for some time..
The sorting layer bug got sorted out with the latest revision of the runtime, however the bug that prevents meshes from rebuilding after I hit play mode is still there.
The meshes rebuild "more often" now, but they still randomly disappear while I work on the scene.. very annoying, as I'm using the submesh separators for everything basically. 80% of my scene will be invisible from time to time and it's disrupting my workflow..

I took a look at the runtime source code but I know too little about this to fix it by myself..