Repository navigation
Fix CUIGraphic compile error on Unity 6.7 - #538
armadavalor wants to merge 4 commits into
Conversation
| // use tangent and start and end time to derive control point 2 and 3 | ||
| } | ||
|
|
||
| #if !UNITY_6000_7_OR_NEWER |
There was a problem hiding this comment.
This would probably be better as a compound statement
#if UNITY_6000_6_OR_NEWER && !UNITY_6000_7_OR_NEWER
There was a problem hiding this comment.
Thanks, switched the attribute guard to #if UNITY_6000_6_OR_NEWER && !UNITY_6000_7_OR_NEWER in aea7c57. The outer #if !UNITY_6000_7_OR_NEWER stays so the ModifyMesh(Mesh) override itself is still compiled out on 6.7+.
There was a problem hiding this comment.
You shouldn't need "both" because the second will not be seen by the first.
Essentially, can you test with ONLY the dual line, which states:
Include only IF
Version is > 6000_3 - UNITY_6000_6_OR_NEWER
AND
Version is < 6000_7 - !UNITY_6000_7_OR_NEWER
Can you test with just that one #if line please and update
There was a problem hiding this comment.
You're right that the inner && !UNITY_6000_7_OR_NEWER is redundant inside the outer guard, sorry for the noise.
The catch with the compound line alone is that it only guards the [Obsolete] attribute. The public override void ModifyMesh(Mesh _mesh) method below it would still compile on 6.7, where BaseMeshEffect no longer has that method, so we'd be back to CS0115 from #535. Something has to keep the method itself out on 6.7. I can't compile against a 6.7 editor locally, so I can't test that variant directly.
Two options, whichever you prefer:
- Keep the outer
#if !UNITY_6000_7_OR_NEWERaround the method, with the original#if UNITY_6000_6_OR_NEWERfor the attribute (no compound needed since it's nested). - Drop the
ModifyMesh(Mesh)override entirely. On versions that still have it, the baseBaseMeshEffect.ModifyMesh(Mesh)does the same thing (wraps the mesh in aVertexHelper, callsModifyMesh(VertexHelper), fills it back), and ourModifyMesh(VertexHelper)already returns early when inactive. No version guards at all.
Happy to push either.
There was a problem hiding this comment.
Thanks for that investigation, I too missed the exception was limited to only he override flag and not the entire method.
I think you are right, we just drop the method entirely now if they are using 6000_3 or higher, rather than even having the obsolete flag. Still need to retain it for older versions.
So simply expand the exclusion for the entire method with #if !UNITY_6000_6_OR_NEWER and drop the obsolete attribute.
That was the override will be excluded from all newer builds entirely
Thoughts?
(the perils of having to support earlier Unity releases :D )
There was a problem hiding this comment.
Agreed, done in b3e49e9: the whole ModifyMesh(Mesh) override is now inside #if !UNITY_6000_6_OR_NEWER and the [Obsolete] attribute is gone, so 6.6+ just uses the base implementation and older versions keep the override. I don't have a 6.6/6.7 editor here, so this is compile-checked by reading only.
Overview
CUIGraphicoverridesModifyMesh(Mesh), which no longer exists onBaseMeshEffectin Unity 6.7, so the package fails to compile there with CS0115 ("no suitable method found to override"). In 6.6 the method is only obsolete.Changes
Compile the
ModifyMesh(Mesh)override only whenUNITY_6000_7_OR_NEWERis not defined. TheModifyMesh(VertexHelper)override already does the work and is unchanged.Fixes: BUG: CUIGraphic.ModifyMesh(Mesh)': no suitable method found to override #535
Breaking Changes
Testing status
Manual testing status
Not compiled in Unity (no 6.7 editor available). The only caller of the
Meshoverload is itself, and the change only wraps it in a version guard.Closes #535