Hey Guys, as you can read in my question above I guess I have problems with the access between my scripts and I am a total beginner in Unity and scripting.
So, to explain my problem to you guys …my FirstPersonController has a Mouse Look script in C#, a Character Motor script in JS and a FPS Input Controller also in JS.
I will just mention these at the moment, because I think that these are the important scripts that may cause the problem.
This is my script for the pause menu in my game. Everthing works well, except set the time to zero and the player+main camera can still move, while the pause menu runs. My console do not show any errors.
using UnityEngine;
using System.Collections;
using UnityStandardAssets.Characters.FirstPerson;
public class PauseGame : MonoBehaviour {
public Transform canvas;
public Transform pauseMenu;
public Transform Player;
SaveGame saveGame;
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.Escape))
{
Pause();
}
}
public void Pause()
{
if (canvas.gameObject.activeInHierarchy == false)
{
if (pauseMenu.gameObject.activeInHierarchy == false)
{
pauseMenu.gameObject.SetActive (true);
}
canvas.gameObject.SetActive (true);
Time.timeScale = 0;
Player.GetComponent<FirstPersonController> ().enabled = false;
saveGame = gameObject.GetComponent<SaveGame> ();
saveGame.SaveGameSettings (true);
} else
{
canvas.gameObject.SetActive (false);
Time.timeScale = 1;
Player.GetComponent<FirstPersonController> ().enabled = true;
}
}
}
I hope someone can help me out, somehow. It’s maybe totally obvious, but I’m clueless on this.
By the way, I may not know all of the technical terms and my english is also not the best.