- Home /
Spline Controller (javascript) error
I've downloaded the Javascript version of the Unify Community "Spline Controller", which consists of three javascript files (MathUtils.js, SplineController.js, and SplineInterpolator.js) but when i try to import the scripts as assets in my project i get this error message:
"Sistem.Collections.IComparer" is not a class. "extends" can only be used with classes. Did you mean "Implements"?
The error refers to SplineController.js
What's the problem? Do you know if i have to create specific folders in which i have to import these scripts? or maybe i have to load other specific assets necessary to make these scripts work?
Answer by Mortoc · Jul 30, 2012 at 09:48 PM
I'm not sure why the script wouldn't compile straight out of the box, but the compile error looks simple enough to fix. It's an interface you implement rather than a base class to extend. You can use it like this:
http://msdn.microsoft.com/en-us/library/h30d6hy0(v=vs.71).aspx
i don't understand, i'm quite new to scripting, what should i do? modify the splinecontroller.js code? how? have i to add something?
Yes, you'd have to modify splinecontroller.js in the way the article I linked describes. If that level of scripting is above your skill level, do the scripting tutorials on the Unity site, it'll serve you much better to understand these things work when using them.
are you sure the problem isn't because i miss some other script required to make this one work?
That particular error you have is because the wrong keyword is being used in your script. That just means there's an error in that script.
Answer by Mz3D · Jul 30, 2012 at 11:31 PM
Solved! i had to add this declaration at the beginning!
public class IComparer
{
//code
}
That doesn't make much sense. IComparer is an interface, not a class. The UnityScript syntax has been changed recently so you can also implement multiple interfaces in UnityScript, but you have to use the implements keyword ins$$anonymous$$d of extends.
extends now only works with base classes.
In fact, it didn't work! Now i changed "extends" with "implements" and it works!
Your answer
Follow this Question
Related Questions
I've got a coding problem please help 1 Answer
Why am I getting this error repeatedly? 2 Answers
BCE0005: Unknown identifier: 'spriteRenderer'. 2 Answers
How to check integrity of Assets? 0 Answers