Question by
mchuang1209 · May 16, 2017 at 02:14 PM ·
unity 5scripting problemscript.
How can I act the scrip that in the FirstPersonCharacter?
I want input "esc" to act the scrip "Fur" (in picture1)but I fail , somebody can help me?Thank!!! My English isn't very good, please don't mind. ][1]
public Transform canvas; public Transform Player;
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
{
Pause();
}
}
public void Pause()
{
if (canvas.gameObject.activeInHierarchy == false)
{
gameObject.GetComponent<fur>.enabled = false;
Cursor.visible = true;
canvas.gameObject.SetActive(true);
Time.timeScale = 0;
Player.GetComponent<FirstPersonController>().enabled = false;
}
else
{
Cursor.visible = false;
canvas.gameObject.SetActive(false);
Time.timeScale = 1;
Player.GetComponent<FirstPersonController>().enabled = true;
}
}
}
Comment