Despite reading everything I can find on the matter I can’t seem to figure this out. I have a camera called “standbyCamera” that is deactivated by a script called NetworkManager.cs. I have another script that is attached to the player called health.cs that I would like to reactivate it. Here are simplified versions of those scripts:
NetowkManager.cs:
using UnityEngine;
using System.Collections.Generic;
public class NetworkManager : MonoBehaviour {
public GameObject standbyCamera;
public void SpawnMyPlayer () {
standbyCamera.SetActive (false);
}
}
Health.cs:
using UnityEngine;
using System.Collections;
public class Health : MonoBehaviour {
public float HP = 100f;
public float currentHP;
private NetworkManager _NetworkManager;
public GameObject _standbyCamera;
void Start () {
currentHP = HP;
_standbyCamera = GameObject.Find("standbyCamera")
[RPC]
public void TakeDamage (float amt) {
currentHP -= amt;
if (currentHP <= 0) {
Die ();
}
}
public void Die () {
_standbyCamera.SetActive (true); // This should be set to the same camera as the Network Manager script, but I don't know how to do that.
}
}
Any help would be greatly appreciated. Thanks!