Hello,
I have this error :
"Error CS1660 Cannot convert lambda expression to type 'IComparer<T>' because it is not a delegate type lastTime.CSharp" CombuScriptsCombuPlatform.cs 178
What can I do with that?
I haven't any Sort or Comparer at line 178 of latest Combu, can you please post the line?
EDIT:
Nevermind, I was looking at older scripts, I see achievements.Sort at that line, I'll investigate.
FRANCESCO CROCETTI @ SKARED CREATIONS
achievements.Sort((Achievement a, Achievement b) => {
I tried to call the following after a successful login but I'm not having any warning/error:
Debug.Log(obj.Length);
});
What Unity version and platform (and deploy platform) are you using?
Also I read something about "lastTime" but we haven't any variable with this name in our scripts.
FRANCESCO CROCETTI @ SKARED CREATIONS
Skared Creations said
I tried to call the following after a successful login but I'm not having any warning/error:CombuManager.platform.LoadAchievements((IAchievement[] obj) => {
Debug.Log(obj.Length);
});What Unity version and platform (and deploy platform) are you using?
Also I read something about "lastTime" but we haven't any variable with this name in our scripts.
No, lastTime - this is my script, LastTimeUser.cs
Unity 5.2.1
Microsoft Visual Studio Community 2015 - IDE
Unity web player
I have this error in Visual Studio, Unity works correct...
Try this in Achievement.cs
- add the interface IComparer to declaration:
- add the following code in the class Achievement (you can probably remove the comparer in CombuPlatform.LoadAchievements and call directly Sort without parameter, try that too):
public int Compare (object x, object y)
{
IAchievement a = (IAchievement)x;
IAchievement b = (IAchievement)y;
long idA = long.Parse(a.id);
long idB = long.Parse(b.id);
if (idA == idB)
return a.percentCompleted.CompareTo(b.percentCompleted);
return idA.CompareTo(idB);
}
#endregion
See if this will solve VS complain.
FRANCESCO CROCETTI @ SKARED CREATIONS
It works in visual studio , but if in CombuPlatform remove this
achievements.Sort((Achievement a, Achievement b) => {
long idA = long.Parse(a.id);
long idB = long.Parse(b.id);
if (idA == idB)
return a.percentCompleted.CompareTo(b.percentCompleted);
return idA.CompareTo(idB);
});
and I write this
achievements.Sort();
In Unity I have this error:
ArgumentException: does not implement right interface
System.Collections.Generic.Comparer`1+DefaultComparer[Combu.Achievement].Compare (Combu.Achievement x, Combu.Achievement y) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/Comparer.cs:86)
System.Array.compare[Achievement] (Combu.Achievement value1, Combu.Achievement value2, IComparer`1 comparer) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Array.cs:1744)
System.Array.qsort[Achievement,Achievement] (Combu.Achievement[] keys, Combu.Achievement[] items, Int32 low0, Int32 high0, IComparer`1 comparer) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Array.cs:1721)
System.Array.Sort[Achievement,Achievement] (Combu.Achievement[] keys, Combu.Achievement[] items, Int32 index, Int32 length, IComparer`1 comparer) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Array.cs:1674)
Rethrow as InvalidOperationException: The comparer threw an exception.
System.Array.Sort[Achievement,Achievement] (Combu.Achievement[] keys, Combu.Achievement[] items, Int32 index, Int32 length, IComparer`1 comparer) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Array.cs:1677)
System.Array.Sort[Achievement] (Combu.Achievement[] array, Int32 index, Int32 length, IComparer`1 comparer) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/Array.cs:1623)
System.Collections.Generic.List`1[Combu.Achievement].Sort () (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:568)
Combu.CombuPlatform+c__AnonStorey30`1[Combu.Achievement].<>m__3A (System.String text, System.String error) (at Assets/AllScripts/Combu/Scripts/CombuPlatform.cs:185)
Combu.CombuManager+c__Iterator1.MoveNext () (at Assets/AllScripts/Combu/Scripts/CombuManager.cs:411)