Hello everyone! I have a question about using an enum from one script as a parameter in a function in a nother script:
Here is my code for the script with the enum
using UnityEngine;
using System.Collections;
public class scr_cutscene_camera : MonoBehaviour
{
public enum CamZoom{none, zoom_in, zoom_out};
public CamZoom myZoom;
void Start()
{
myZoom = CamZoom.zoom_in;
}
}
And here is the script I’d like to control it with in some functions
using UnityEngine;
using System.Collections;
public class scr_cutscene_controller : MonoBehaviour
{
public GameObject camera_ref;
scr_cutscene_camera srcc;
void Start ()
{
srcc = camera_ref.GetComponent<scr_cutscene_camera>();
}
void Update ()
{
if (Input.GetKey(KeyCode.H))
{
srcc.myZoom = scr_cutscene_camera.CamZoom.zoom_in;
}
else
{
srcc.myZoom = scr_cutscene_camera.CamZoom.none;
}
}
void CreateShot(enum CamZoom_variable)
{
srcc.myZoom = scr_cutscene_camera.CamZoom.CamZoom_variable;
}
}
The problem is using a enum variable in the function. It isn’t working. I understand that enums aren’t really variables, and are kind of special, but I am not sure how to go about working around this. Thank you for your time!