I have a WeaponCamera, that is a parent to WeaponHolder, which is a parent to the sniper rifle. The script, when RMB is pressed, the WeaponCamera is set to false. Obviously, this would make everything a child to it, stop running. When I release RMB, the ScopeOverlay stays active, and the WeaponCamera stays deactivated, etc. How would I make it so that when OnScoped is true, the script of ‘Sniper’ is still active, but the weapon itself isn’t?(so it does’t show up in the scopeOverlay)
public GameObject scopeOverlay;
public GameObject WeaponCamera;
public float overlayDelay = .15f;
public float ScopeZoom = 15f;
void UnScoped () {
scopeOverlay.SetActive (false);
mainCamera.fieldOfView = 60f;
WeaponCamera.SetActive (true);
}
IEnumerator OnScoped () {
yield return new WaitForSeconds (overlayDelay);
yield return new WaitForSeconds (.02f);
scopeOverlay.SetActive (true);
WeaponCamera.SetActive (false);
mainCamera.fieldOfView = ScopeZoom;
}