SOLVED: Error On Build (CS1061) 'MeshRenderer' does not contain a definition for 'scaleInLightmap'

When building, the build fails with the error:

Assets\Unity.VisualScripting.Generated\VisualScripting.Core\AotStubs.cs(39713,28): error CS1061: 'MeshRenderer' does not contain a definition for 'scaleInLightmap' and no accessible extension method 'scaleInLightmap' accepting a first argument of type 'MeshRenderer' could be found (are you missing a using directive or an assembly reference?)

How to fix this issue? I've updated from Unity 2022 to 2023. I've dropped this over the the UVS Forum, but nobody replies over there. I can remove the three offending Editor Only lines from the AOTStubs file, but that file is generated upon every new build.

Not sure what API in the Nodes Library is creating this.

SOLVED: Beware when exposing MeshRenderer unit; there are three Editor-specific values that expose ReceiveGI, StitchLightmapSeams and ScaleInLightmap. Regardless if you have these three types in your Types Library or not, they will fail a build 100% of the time! The workaround is to instead expose the GameObject and get the MeshRenderer this way.


Hey! I believe you just need to delete Unity.VisualScripting.Generated folder in the Assets folder. It will regenerate and it should build fine afterwards. It was very frustrating and worrying too before I found this out...

Nope. Same issue, even after deleting the folder.

I would give a shot then to also rebuild the whole project. You can do that by deleting everything in the project folder except Assets, Packages, Project Settings and User Settings folders. I would also delete Unity.VisualScripting.Generated folder again at the same time. And better use latest LTS Unity versions if you are not using them already. Sorry if it doesn't help, that's all I can do. Good luck

Anybody else? Help?!

dlobser ( ) and I solved it using the methods mentioned. If they don't work for you, it looks like your only option is to report the bug to Unity and wait months until (if) it's resolved or to start a new project and pray it doesn't happen again...

Have tried building a clean build into an empty folder after deleting Unity.VisualScripting.Generated? "To force a clean build instead of an incremental build, select Clean Build from the dropdown menu."

Not after four years of development! Funny how everything works in Unity and then you decide to update the engine and official plugin, because you assume IT'LL JUST BE BETTER and then it fucks you completely, isn't it?

MeshRenderer does not contain a definition for scaleInLightmap
MeshRenderer does not contain a definition for receiveGI
MeshRenderer does not contain a definition for stitchLightmapSeams

It's these three, every time.

I know how IT world is often frustrating and painful. But that's how it currently is. Only a minority survives and becomes successful after many years :smile: I saw that you're using Unity 2023 in another thread I'm following. And I know that's painful, but if nothing works then moving to the latest LTS 2022 version might help. Funny because it's 2024 and the 2023 version is considered too new and dangerous :smile:

I feel this is somehow linked to AotStubs generation; why would the game run flawlessly in the Editor and be unable to build? I feel since upgrading from UVS 1.7, to the latest, it went wrong from there.

Try reverting UVS versions, and if it doesn't help then your own project backup versions until you catch the reason

Took your advice and reverted to UVS 1.8.0, deleted everything in the project folder except the items you've listed. Rebuilt the AotStubs file...and STILL the three Editor-only MeshRenderer errors cause the build to fail at "Compiling Script Assemblies"!

@dlobser Is it possible to get your feedback on this? You're only the third person to encounter this issue!

@jeanedouard_unity Could you possibly run your eyes over this?

I am sorry nothing works for you. Have you reported this to Unity through editor's bug reporting tool? They sometimes give you a solution if they are not planning to fix something. Everyone in the UVS community would appreciate that.

Not long ago they gave me a solution to a problem I thought was a bug after I reported it.

Please file an issue using the Unity bug reporting tool, it is just not possible for us to properly investigate only with the details described here.

@Ignacii Would you mind sharing your Node Library with me? Just a screencap?

Hi. Why? If you want to see the default one you can make a new empty project for that. I'm using many external assets with their APIs. It's cluttered and going to be even more cluttered in the future, because I love Unity assets very much :smile:

@MrTaffy I see you marked this thread as resolved. I would love to know what worked for you. It can strike any of us at any time...