Forum rules - please read before posting.

Sorry... Cinemachine Question

edited January 2018 in Technical Q&A
Hey,

When using actions, what is the best way to switch between vcams when entering a trigger for example.


Will

Comments

  • edited January 2018
    IIRC you can switch Cinemachine cameras by enabling the new one and disabling the old one.

    You could feasibly do this with animations (and then controlling animation playback with the Object: Animate Action), but if you have coding knowledge you could also do it via custom Actions.
  • Thanks! 

    I managed to make a quick Custom Action script which can enable/disable gameobjects and then setting priority settings on the vcams. 

    Thanks

    using UnityEngine;
    using System.Collections;

    #if UNITY_EDITOR
    using UnityEditor;

    namespace AC
    {

        [System.Serializable]
    public class ActionEnableGameobject : Action
        {

            public GameObject objectToAffect;
    public bool enabled = false;


    public ActionEnableGameobject()
            {
                this.isDisplayed = true;
                category = ActionCategory.Object;
                title = "Enable GameObject";
                description = "This action can toggle on/ff a Gameobject";
            }

            void Update()
            {
                // Return a string used to describe the specific action's job.
                if (objectToAffect)
                {
                    objectToAffect.SetActive(enabled);
                }
            }

    #if UNITY_EDITOR

            override public void ShowGUI()
            {
            objectToAffect = (GameObject)EditorGUILayout.ObjectField("GameObject to affect:", objectToAffect, typeof(GameObject), true);
        enabled = (bool)EditorGUILayout.Toggle(enabled);
            }




        }

    }

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.