- Home /
No overload for method "X" takes `1' arguments
Hello Guys, I'm having a problem with the Draw Call Optimizer from AssetStore.
At the line 136,
Mesh[] combinedMeshes = MeshCombineUtility.Combine(meshIntermediates.ToArray());
Indicates the following error
No overload for method `Combine' takes `1' arguments
I tried to use, in the script where the error shows up :
Using MeshCombineUtility;
but still I was getting an error (cause' it's not a unity system type).
This is the Start sequence from the first script
void Start()
{
MeshFilter[] filters = GetComponentsInChildren<MeshFilter>();
Matrix4x4 myTransform = transform.worldToLocalMatrix;
Dictionary<string, Dictionary<Material, List<MeshCombineUtility.MeshInstance>>> allMeshesAndMaterials = new Dictionary<string, Dictionary<Material, List<MeshCombineUtility.MeshInstance>>>();
for(int i = 0; i < filters.Length; i++)
{
Renderer curRenderer = filters[i].renderer;
MeshCombineUtility.MeshInstance instance = new MeshCombineUtility.MeshInstance();
instance.mesh = filters[i].mesh;
if(curRenderer != null && curRenderer.enabled && instance.mesh != null)
{
In MeshCombineUtility.cs, the 2nd script, I have the following definitions :
public class MeshCombineUtility
{
public struct MeshInstance
{
public Mesh mesh;
public int subMeshIndex;
public Matrix4x4 transform;
}
public static Mesh Combine (MeshInstance[] combines, bool generateStrips)
{
int vertexCount = 0;
int triangleCount = 0;
int stripCount = 0;
foreach( MeshInstance combine in combines )
{........................................
Thank you for further help.
//EDIT
Seems that adding a boolean here
Mesh[] combinedMeshes = MeshCombineUtility.Combine(meshIntermediates.ToArray());
results into a matrix error : Cannot implicitly convert type UnityEngine.Mesh' to
UnityEngine.Mesh[]'
Ok, So I've tried this but I get an error with the matrix. Cannot implicitly convert type UnityEngine.$$anonymous$$esh' to
UnityEngine.$$anonymous$$esh[]'
Again. Your function returns $$anonymous$$esh
, your variable type is $$anonymous$$esh[]
. Wont budge. So change to $$anonymous$$esh combined$$anonymous$$eshes = $$anonymous$$eshCombineUtility.Combine(......
.
Please, it's not that simple. If I do that I will get a "missing a using directive" error
Ok Sir. Fattie, I applied what you said and I had to cut down all the matrixes. Now I get no more errors.
I'll be back with a new reply in about 10-30 $$anonymous$$utes.
//Later Edit
Thank you Lovrenc and Fattie.
Although I had to remove the [i] construnctions it's working pretty well.
Answer by Lovrenc · Dec 28, 2012 at 09:41 AM
Function ID:
public static MeshCombine
(MeshInstance[] combines, bool generateStrips)
Your call:
MeshCombineUtility.Combine(meshIntermediates.ToArray());
Seems like youre missing a boolean in your call. Try:
MeshCombineUtility.Combine(meshIntermediates.ToArray(), false);
use true or false depending on your needs.
Also. Your function returns Mesh. Your variable type is Mesh[]
Change to:
Mesh combinedMeshes = MeshCombineUtility.Combine(.......
Your answer
Follow this Question
Related Questions
CombineMeshes() Not Working Properly? 0 Answers
Assertion failed on expression: '(int)lastVertex < GetVertexCount()' 1 Answer
CombineMeshes not working on one machine but is on another 1 Answer
C# No overload for method 'BeOlvasBabok' takes 1 arguments 1 Answer
Occlusion culling and mesh combining possible and working? 0 Answers