- Home /
This question was
closed May 14, 2013 at 08:33 AM by
Fattie for the following reason:
Problem is not reproducible or outdated
Question by
Onatalp · May 13, 2013 at 04:53 AM ·
javascriptprogramming
Getting Error "No appropriate version of 'UnityEngine.GameObject.GetComponent' for the argument list '(UnityEngine.GameObject)' was found."
Im trying to make it so that my character(and the whole game) could pause in place, get the objective box, the player clicks the objective box, and the game un-pauses. I keep on getting this error though which is keeping me from progressing.
pragma strict
var player : GameObject;
var bool : boolean;
function OnTriggerEnter(other : Collider) {
if(other.tag == "Player"){
bool = true;
player.GetComponent(player).speed = 0;
}
}
function OnGUI() {
if(bool == true) {
if(GUI.Button (Rect ( 100, 100, 350, 150), "Soldier! Your mission is to get to MotherRobo's intel area!")) {
Debug.Log("Door Works!");
bool = false;
player.GetComponent(player).speed = 10;
Destroy(gameObject);
}
}
}
Comment
hard to tell what you're trying to do.
capitalize Player?
read up on this page if that's not it: http://docs.unity3d.com/Documentation/ScriptReference/GameObject.GetComponent.html
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Unity fire1 prefab in code 2 Answers
What is a good unityscript writing program? 1 Answer