|
I followed a tutorial i am sure i have exactly what he had except for the name but i keep getting this error "Assets/Galaxy_Quest/Scripts/s_HUD.js(12,43): BCE0017: The best overload for the method 'UnityEngine.Object.FindObjectOfType(System.Type)' is not compatible with the argument list '(s_mainCharacter)'." here is my code for both files: *s_mainCharacter*
*s_HUD.js*
(comments are locked)
|
|
You named your variable the same as the class Change it to something else and it should work Edit for the sake of clarity: The error you're getting is because you're trying to pass an instance of the class instead of the class type itself to the function Example which doesn't work:
Example which works: Ok, I voted you up, because I figured I may as well test his code, and you were correct. Funny thing is I posted something similar to that as a comment like 15 minutes after he asked the question and he never commented anything back. I said "I don't think that's the problem", but it actually was anyway and if he had read it and tried it, this whole debate would be over. The other thing is that the line number is wrong. He formatted his code before he posted here, because even if you remove the comments, the error is on line 13. So I'm not sure what else he added or removed.
Jul 27 '10 at 12:16 PM
Peter G
(comments are locked)
|

I don't think this is the problem, but it isn't normally a good convention to name a variable the same thing as its type. It just gets confusing like var float : float;