Hey guys this is my first time try to make simple game in Unity but i got stuck in movement script,
I already have script for my player called "player" script, so now i'm trying to make a script for my controller which is a touchscreen pad, like moving left, right and jump, i'm following youtube tutorial,
Even my script and the tutorial script are same, but mine is got error, it said my GameObject is not found or missing... Here's my pad script
public class TouchPad :
MonoBehaviour {
public GameObject player;
public void OnMouseDown()
{
if (gameObject.name ==
"Left")
{
}
else if (gameObject.name ==
"Right")
{
}
else if (gameObject.name ==
"Jump")
{
}
}
public void OnMouseUp()
{
if (gameObject.name == "Left")
{
}
else if (gameObject.name ==
"Right")
{
}
else if (gameObject.name ==
"Jump")
{
}
}
public void OnMouseDrag()
{
if (gameObject.name ==
"Left")
{
player.GetComponent<player>.
().Left(); <<<<<<< The
<player> got "Could not be
Found"
}
else if (gameObject.name ==
"Right")
{
}
else if (gameObject.name ==
"Jump")
{
}
}
}