Skip to content

Fix CUIGraphic compile error on Unity 6.7 - #538

Open
armadavalor wants to merge 4 commits into
Unity-UI-Extensions:developmentfrom
armadavalor:fix/curlyui-modifymesh-unity-6-7
Open

armadavalor wants to merge 4 commits into
Unity-UI-Extensions:developmentfrom
armadavalor:fix/curlyui-modifymesh-unity-6-7

Conversation

@armadavalor

@armadavalor armadavalor commented Oct 25, 2026 •

Copy link
Copy Markdown

Overview

CUIGraphic overrides ModifyMesh(Mesh), which no longer exists on BaseMeshEffect in 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

Breaking Changes

  • None. Unity 6.6 and older still get the override.

Testing status

  • No tests have been added.

Manual testing status

Not compiled in Unity (no 6.7 editor available). The only caller of the Mesh overload is itself, and the change only wraps it in a version guard.

Closes #535

// use tangent and start and end time to derive control point 2 and 3
}

#if !UNITY_6000_7_OR_NEWER

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would probably be better as a compound statement
#if UNITY_6000_6_OR_NEWER && !UNITY_6000_7_OR_NEWER

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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+.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Keep the outer #if !UNITY_6000_7_OR_NEWER around the method, with the original #if UNITY_6000_6_OR_NEWER for the attribute (no compound needed since it's nested).
  2. Drop the ModifyMesh(Mesh) override entirely. On versions that still have it, the base BaseMeshEffect.ModifyMesh(Mesh) does the same thing (wraps the mesh in a VertexHelper, calls ModifyMesh(VertexHelper), fills it back), and our ModifyMesh(VertexHelper) already returns early when inactive. No version guards at all.

Happy to push either.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 )

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants