"Can't add script behaviour"

Hello,

Maybe I’m doing something wrong, but I imported all the assets with the free package into my project. Made a new gameObject called “A*” and tried to add the “AstarPath” script, because it doesn’t appear in my “Component” drop down.

I tried restarting. All the example scenes have the same errors.

“Can’t add script behaviour AstarPath. The scripts file name does not match the name of the class defined in the script!”

Weird. Sure there are no compile errors anywhere in the log?
That could prevent it from being compiled and thus would prevent it to be attached.
Also check that you haven’t got any other classes named AstarPath (of some reason) in your project.

I did, but when restarting they went away… Although I deleted the package and reimported and they came back:

“Assets/AstarPathfindingProject/Modifiers/AlternativePath.cs(51,30): error CS0115: `AlternativePath.Apply(Path, Pathfinding.ModifierData)’ is marked as an override but no suitable method found to override”

“Assets/AstarPathfindingProject/Modifiers/FunnelModifier.cs(43,30): error CS0115: `FunnelModifier.Apply(Path, Pathfinding.ModifierData)’ is marked as an override but no suitable method found to override”

I have another 3 cases of this in other scripts. Any thoughts?

I think you have a class in your project named “Modifier” (or “MonoModifier” perhaps, but probably not) which conflicts with the A* Pathfinding Project. Try to find it.

I’ve reopened my scene again. No compiler errors again, as if they never existed. Yet I still don’t have the valid menu component or the ability to apply the script. :frowning:

Unity will probably not log the compiler errors until some script is recompiled, try to select a script asset and right click on it and select Reimport, that would force recompilation and probably log the error messages again.