Links

Changing Character Controller

When we interact with the padlock we disable character movement and camera rotation. In the “DisableManager” script we reference the player controller so we can disable the “FirstPersonController” script.
NOTE: If you’re using a different controller please replace these lines with appropriate for you, as can be seen below from the comments. Create a new reference to your character controller and disable movement and camera rotation for your controller.
public class PLDisableManager : MonoBehaviour
{
[SerializeField] private FirstPersonController player = null; //EDIT THIS
[SerializeField] private PLRaycast mainCameraRaycast = null;
​
public static PLDisableManager instance;
​
void Awake()
{
if (instance != null) { Destroy(gameObject); }
else { instance = this; DontDestroyOnLoad(gameObject); }
}
​
public void DisablePlayer(bool disable)
{
if (disable)
{
player.enabled = false; //EDIT THIS
PLUIManager.instance.DisableCrosshair(true);
mainCameraRaycast.enabled = false;
}
​
else
{
player.enabled = true; //EDIT THIS
PLUIManager.instance.DisableCrosshair(false);
mainCameraRaycast.enabled = true;
}
}
}