Search Unity

Probuilder Preventing Builds with "Mesh.colors is out of bounds" Errors

Discussion in 'World Building' started by ghostaegis, Jan 6, 2021.

  1. ghostaegis

    ghostaegis

    Joined:
    Dec 1, 2016
    Posts:
    19
    For some reason, I'm getting issues when attempting to build my project. Sometimes, but not always, the build fails with various numbers of errors (anywhere from 4 to 80+) all the same: Mesh.colors is out of bounds. I'll post a copy of one of these pulled from the build log below (they're all identical).

    The number of errors isn't constant, and it's not even reliable. Sometimes I can get a build off by opening the problem scenes and mass applying white vertex color to all objects in the scene (which isn't a problem as we aren't using vertex colors on the objects in the first place).

    But even if I get a build to complete, trying to run a build again immediately causes a new batch of the same errors.

    I need a more permanent solution to this, any ideas?

    Error log:

    [C:\buildslave\unity\build\Runtime/Graphics/Mesh/Mesh.cpp line 1051]
    (Filename: Library/PackageCache/com.unity.probuilder@4.4.0/Runtime/Core/ProBuilderMeshFunction.cs Line: 493)

    Mesh.colors is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
    UnityEngine.Mesh:SetArrayForChannelImpl(VertexAttribute, VertexAttributeFormat, Int32, Array, Int32, Int32, Int32)
    UnityEngine.Mesh:SetSizedArrayForChannel(VertexAttribute, VertexAttributeFormat, Int32, Array, Int32, Int32, Int32)
    UnityEngine.Mesh:SetArrayForChannel(VertexAttribute, Color[])
    UnityEngine.Mesh:set_colors(Color[])
    UnityEngine.ProBuilder.ProBuilderMesh:RefreshColors() (at Library\PackageCache\com.unity.probuilder@4.4.0\Runtime\Core\ProBuilderMeshFunction.cs:493)
    UnityEngine.ProBuilder.ProBuilderMesh:Refresh(RefreshMask) (at Library\PackageCache\com.unity.probuilder@4.4.0\Runtime\Core\ProBuilderMeshFunction.cs:381)
    UnityEngine.ProBuilder.ProBuilderMesh:MakeUnique() (at Library\PackageCache\com.unity.probuilder@4.4.0\Runtime\Core\ProBuilderMeshFunction.cs:335)
    UnityEditor.ProBuilder.EditorUtility:SynchronizeWithMeshFilter(ProBuilderMesh) (at Library\PackageCache\com.unity.probuilder@4.4.0\Editor\EditorCore\EditorUtility.cs:233)
    UnityEditor.ProBuilder.UnityScenePostProcessor:OnPostprocessScene() (at Library\PackageCache\com.unity.probuilder@4.4.0\Editor\EditorCore\UnityScenePostProcessor.cs:55)
    System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
    System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
    System.Reflection.MethodBase:Invoke(Object, Object[])
    UnityEditor.Build.AttributeCallbackWrapper:OnProcessScene(Scene, BuildReport)
    UnityEditor.Build.<>c__DisplayClass16_0:<OnSceneProcess>b__1(IProcessSceneWithReport)
    UnityEditor.Build.BuildPipelineInterfaces:InvokeCallbackInterfacesPair(List`1, Action`1, List`1, Action`1, Boolean)
    UnityEditor.Build.BuildPipelineInterfaces:OnSceneProcess(Scene, BuildReport)
    UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, Boolean)
    UnityEditor.DefaultBuildMethods:BuildPlayer(BuildPlayerOptions)
    UnityEditor.BuildPlayerWindow:CallBuildMethods(Boolean, BuildOptions)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun(Boolean)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
    UnityEditor.EditorApplication:ExecuteMenuItem(String)
    UnityEditor.ShortcutManagement.MenuItemEntryDiscoveryInfo:<.ctor>b__7_0(ShortcutArguments)
    UnityEditor.ShortcutManagement.Trigger:HandleKeyEvent(Event, IContextManager)
    UnityEditor.ShortcutManagement.ShortcutController:HandleKeyEvent(Event)
    UnityEditor.ShortcutManagement.ShortcutIntegration:EventHandler()
    UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()
     
  2. Mal_Duffin

    Mal_Duffin

    Joined:
    Jan 22, 2015
    Posts:
    71
    I'm getting a similar problem when trying to build - it *seems* to be for 64 bit platforms rather than 32, but I haven't tried enough variations to see if that is the problem.

    Windows 10, Unity 2021.1f1


    Mesh.colors is out of bounds. The supplied array needs to be the same size as the Mesh.vertices array.
    UnityEngine.GUIUtility:processEvent (int,intptr,bool&)


    Update: I *seem* to have fixed it by loading up all of the scenes in the build, and running the...
    Tools->PolyBuilder->Repair->Rebuild All Probuilder Objects
     
    Last edited: Jan 9, 2021
    superdupergc likes this.
  3. ghostaegis

    ghostaegis

    Joined:
    Dec 1, 2016
    Posts:
    19
    I've tried that too, but it only seems to last for a couple builds. I'm confused how the problem could be coming back. We don't use any vertex color functionality in our pipeline, so we're not changing any of that data on our end. I'd be curious to know if your problem comes back after a few builds as well.
     
    Mal_Duffin likes this.
  4. starvanger

    starvanger

    Joined:
    Oct 4, 2010
    Posts:
    19

    Hi Mal,

    I made a custom repair action which loops trough all scenes.
    This is totally messed up.

    I attached a script, one needs to replace content of repair actions with that, but be carefull, I do not know, which version of probuilder you have.

    It just gives one the idea, how to do it not by hand , if you got a lot of scenes.

    As one overwrites content of the package, the package manager deletes this changes on next unity start. He makes sure, no one changes the packages.

    Rough, but a time saver, unitl this is fixed.


    Greetings and remember me?

    Berndt aka pictofun aka starvanger from the director 3d Lists
     

    Attached Files:

    Last edited: Jan 20, 2021
  5. Mal_Duffin

    Mal_Duffin

    Joined:
    Jan 22, 2015
    Posts:
    71
    Hey there Berndt - great to hear from you! Those Director days were great!!!

    Many thanks for the script, I think I'll use it - this problem has come up again a few times and it will save me having to go through all of the levels!
     
  6. Mal_Duffin

    Mal_Duffin

    Joined:
    Jan 22, 2015
    Posts:
    71
    Berndt, I just went to run the script, it's referencing PreferenceKeys and InternalUtility
     
  7. ErikH2000

    ErikH2000

    Joined:
    Apr 30, 2014
    Posts:
    13
    2021 bump. The same problem is still present using ProBuilder 4.4.0 with Unity 2019.4.13f1.
     
    ZhavShaw likes this.