Forum rules - please read before posting.

Interaction selection with direct controls won't work as expected

2»

Comments

  • Are you running the game in first-person? Those should be the only scenario in which the camera should change without explicitly telling it to do so - as AC will always rely on the first-person camera during gameplay.

    If so, you have to use the Engine: Manage systems Action to change the Movement method to None while you want the camera to remain as something else during gameplay.

    If not, are you using Timeline? If a Timeline controls the camera, the camera will revert back to it's non-Timeline state once the Timeline has completed.

    Otherwise, I can't see why the camera would switch back. Though, you can use this custom script to determine the cause - add it to your scene and select the relevent message in the Console, and copy/paste the full stracktrace in this thread so I can see what's going on.

    using UnityEngine;
    using AC;
    
    public class SwitchCameraEvent : MonoBehaviour
    {
    
        void OnEnable () { EventManager.OnSwitchCamera += OnSwitchCamera; }
        void OnDisable () { EventManager.OnSwitchCamera -= OnSwitchCamera; }
    
        void OnSwitchCamera (_Camera fromCamera, _Camera toCamera, float transitionTime)
        {
            Debug.Log ("Switched to camera: " + toCamera);
        }
    
    }
    

    As for the material issue: there's nothing specific about the Action itself that should cause any difference. It's more likely to do with the ActionList itself.

    The script above works on the assumption that any Hotspot interaction blocks gameplay - even if it's only for a frame. Make sure that the Interaction's When running field is set to Block Gameplay, and I'd expect that you can also replace the Dialogue: Play speech Action with an Engine: Wait Action (try a negative wait value e.g. -1 to only wait a single frame) would also cause the menu to re-appear.

  • It's a side scroller 3d.
    Not using any timeline, simply just switching to a different camera using AC Action Lists.

    Engine/Wait= -1 seemed to have worked.

    I will update this thread as i dig deeper, as you have also suggested.

    Thanks for your help so far!

  • Hello Chris,
    I have discovered another bug/unexpected behaviour with the interaction menu when using the following setup:

    • Direct controls;
    • Interaction Method: Choose Hotspot then Interaction;
    • Select Interaction by: Clicking Menu;
    • Show/hide interactions via script only;
    • Auto Hide interactions based on hotspot;
    • Close hotspots when player leaves hotspot vicinity;

    If the player is inside a hotspot and the hotspot has a single use interaction, the ActionScript associated will play just fine, but once completed, the interaction menu will remain open (even if there are no interactions available associated with the hotspot).

    Not even adding a custom action (containing the line KickStarter.playerMenus.CloseInteractionMenus(); ) at the end of the AS sequence solves the problem.

    I have tried to manually move the hotspot away from the player before the AS finished executing, and this has then allowed the Interaction menu to close at the end of the AS, meaning the problem could be associated with the fact the character is still inside the hotspot once the AS terminated?

    To give you some context, my hotspot contains 1 single interaction (enter door).
    At the beginning of the AS associated with the "enter door" action I check for a global variable (bool). If true, then the player enters the door, if false, a line of dialogue appears.

    The first conditional (true) works as the character leaves the hotspot when entering the door and the Interaction menu gets closed, as expected.

    The second conditional (false), plays the dialogue line but the interaction menu appears at the end of the AS, which is not expected, since the hotspot is set to run a single use interaction.

    Hope you can help!

  • A call to CloseInteractionMenu will turn off any Menu with an Appear type set to On Interaction. Is this the case for your own Interaction menu?

    Here's a script that will print Console messages whenever a Menu named "Interaction" is turned on or off:

    using UnityEngine;
    using AC;
    
    public class MenuEventTest : MonoBehaviour
    {
    
        private void OnEnable()
        {
            EventManager.OnMenuTurnOn += OnMenuTurnOn;
            EventManager.OnMenuTurnOff += OnMenuTurnOff;
        }
    
        private void OnDisable()
        {
            EventManager.OnMenuTurnOn += OnMenuTurnOn;
            EventManager.OnMenuTurnOff += OnMenuTurnOff;
        }
    
        private void OnMenuTurnOn (AC.Menu _menu, bool isInstant)
        {
            if (_menu.title == "Interaction") Debug.Log (_menu.title + " turned on");
        }
    
        private void OnMenuTurnOff (AC.Menu _menu, bool isInstant)
        {
            if (_menu.title == "Interaction") Debug.Log (_menu.title + " turned off");
        }
    
    }
    

    Add it to your scene and change "Interaction" to your own Menu's name - does it display "turn on" messages expectedly, or not display "turn off" messages when expected? If the former, share the stacktrace in full so that we can work out why it's turning on.

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.