private void AddCamera()
        {
            GameObject newCameraObject = new GameObject("Camera");
            Camera     newCamera       = newCameraObject.AddComponent <Camera>();

            newCamera.transform.position = RandomCameraPosition(targetPosition);
            newCamera.transform.LookAt(targetPosition);
            if (attachFollowupCamera)
            {
                FollowupCamera followupCamera = newCamera.gameObject.AddComponent <FollowupCamera>();
                followupCamera.TargetTransform = targetObject;
                followupCamera.Distance        = newCamera.transform.position - targetPosition;
            }
            if (attachLookupCamera)
            {
                LookupCamera lookupCamera = newCamera.gameObject.AddComponent <LookupCamera>();
                lookupCamera.TargetTransform = targetObject;
            }
            Selection.activeGameObject = newCamera.gameObject;

            CameraWorkController currentCameraWorkController = FindCameraWorkController();

            if (currentCameraWorkController == null)
            {
                currentCameraWorkController.transform.parent = newCamera.transform;
                List <CameraWorkGroup> controlCameras  = currentCameraWorkController.controlCameras;
                CameraWorkGroup        cameraWorkGroup = new CameraWorkGroup();
            }
        }
 private CameraWorkController FindCameraWorkController()
 {
     GameObject[] currentSceneObject = SceneManager.GetActiveScene().GetRootGameObjects();
     for (int i = 0; i < currentSceneObject.Length; ++i)
     {
         CameraWorkController cameraWork = currentSceneObject[i].GetComponent <CameraWorkController>();
         if (cameraWork != null)
         {
             return(cameraWork);
         }
     }
     return(null);
 }