Forum rules - please read before posting.

How to pause movTexture video while AC Pause menu is on?

edited October 2020 in Technical Q&A

AC Pause menu pauses gameplay and sound while it's on, but not the movTexture videos such as .ogv files.

I've been trying to check with Get a Menu from script with GetMenuWithName ("Pause"); with no avail.
I checked the AC manual and AC tool kit guide found IsOn but can't use it in my code
Confused a bit.

Here's is what I currently have and it says No overload for method IsOn' takes1' arguments
public class PlayMovie : MonoBehaviour
{
public MovieTexture movTexture;
public SpriteRenderer CheckDummy;
//public Menu Pause;
AC.Menu menu = AC.PlayerMenus.GetMenuWithName ("Pause");

    void Update()
    {
        if ( CheckDummy.GetComponent<Renderer>().enabled == false )

        {
            GetComponent<Renderer>().material.mainTexture = movTexture;
            movTexture.Play();
        }

        if (movTexture.isPlaying && menu.IsOn(true))

        {
            movTexture.Pause();Debug.Log("Menu is null");
    }
    else {
            movTexture.Play();Debug.Log("Menu is null");

    }
}
    }
}

I tried to use
if (movTexture.isPlaying && menu == null
but as soon as I press the video to play it pauses it with out even pressing on game pause menu and stays like that either you pause or unpause.

Using old Unity build 5.2.4f1
AC 1.50f

Comments

  • There is no parameter for the IsOn function.

    Also, your Menu declaration needs to be inside a function.

    Try this:

    using UnityEngine;
    using AC;
    
    public class PlayMovie : MonoBehaviour
    {
        public MovieTexture movTexture;
        public SpriteRenderer CheckDummy;
        AC.Menu menu;
    
        void Update()
        {
            if (menu == null) menu = AC.PlayerMenus.GetMenuWithName ("Pause");
            if (menu == null) return;
    
            if (CheckDummy.GetComponent<Renderer>().enabled == false)
            {
                GetComponent<Renderer>().material.mainTexture = movTexture;
                movTexture.Play();
            }
    
            if (movTexture.isPlaying && menu.IsOn ())
            {
                movTexture.Pause();
            }
            else
            {
                movTexture.Play();
            }
        }
    
    }
    
  • edited October 2020

    Thank you Chris. It works but when you switch through the menus it unfreezes and freezes the video since it turns on and off menus ( I added Options menu to the code to test it).

    So I opted for simple
    if (AC.GlobalVariables.GetBooleanValue(279) == true)
    instead of
    if (movTexture.isPlaying && menu.IsOn(true))

    and removed all AC.Menu lines, and I had to create an action list for pause menu
    Actionlist when turn on where I set my bool to true.
    And created another actionlist that is run on the resume menu button where I set it back to false and use Menu: Change state to turn off Pause menu.

    That way it all runs smooth with no unfreeze videos.

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.