- Home /
Confusing errors in Unity
Hello guys, I have a major issue. Unity says that my monobehaviour classes arent matching the .cs file names which I is entirely wrong (checked it twice) Also it gives me the following error messages:
Assets/_Scripts/Mouse.cs(71,62): error CS1502: The best overloaded method match for
Mouse.UnitAlreadyInCurrentlySelectedUnits(GameObject)' > has some invalid arguments > Assets/_Scripts/Mouse.cs(71,62): error > CS1503: Argument
#1' cannot convertUnityEngine.GameObject' expression to > type
GameObject'
Here is the code:
...
if (!UnitAlreadyInCurrentlySelectedUnits(hit.collider.gameObject)) {
...
// Check if an unit is already in the currently selected units arraylist
public static bool UnitAlreadyInCurrentlySelectedUnits(GameObject Unit){
if (CurrentlySelectedUnits.Count > 0) {
for(int i = 0; i < CurrentlySelectedUnits.Count; i++){
GameObject ArrayListUnit = CurrentlySelectedUnits[i] as GameObject;
if(ArrayListUnit == Unit)
return true;
}
return false;
}
else{
return false;
}
}
Enclosed you will find the .cs file. I have absolutely no clue whats wrong, everything worked just fine a day ago. Maybe you can help me out? Thank you very much in advance.
[link text][1] [1]: /storage/temp/33158-mouse.zip
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Network - Editor + Builds = Problem with RayCasts? 0 Answers
How to check if object is skewed ? 2 Answers
Working with Unity Editor 1 Answer