Quantcast
Channel: Questions in topic: "get"
Viewing all articles
Browse latest Browse all 215

call a coroutine in properity get/set?

$
0
0
I need to call a coroutine MoveCameras() when I enable my camera from my CameraManger script. So I stumbled upon get/set of properities: public bool enableCamera = true; public bool EnableCamera { get { return this.enableCamera; } set { this.enableCamera = value; //Call coroutine on camera disable enable StartCoroutine(CameraManager.instance.MoveCameras()); } } My CameraManger script is "static", I'm taking it with me even when changing scenes. public class CameraManager : MonoBehaviour { public static CameraManager instance; public Camera CameraPlayerOne; public Camera CameraPlayerTwo; public IEnumerator MoveCameras() {/*Move Cameras stuff*/} } I get an error saying that I cannot acces non-static member of outer type 'UnityEngine.MonoBehaviour' via nested type 'PlayerCamera.CameraOptions'. Any hints how I could tackle this problem?

Viewing all articles
Browse latest Browse all 215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>