Forum rules - please read before posting.

How to call a cutscene from the menu script?

edited August 2014 in Technical Q&A
I'd like to change location using a cycle menu element.

I need to do the following:
- Change camera
- Change Navmesh
- Teleport Player

I thought that it would be easier to create specific cutscenes and call them from the OnElementClick method.

I tried to implement this using a variable and adding the action to the OnVariableChange cutscene, but it doesn't work, probably because the game is paused during the menu.

So now I'm creating a specific script, but I need to access to cutscenes through the code to give them the Interact() command.

How could I set a cutscene from the script?

Cutscene myCutscene = ??

Thank you for your help!

I'd like also to know how to find other elements in the scene to use them directly in code.

How to access a camera? ------> 2dCamera myCamera = ??
How to access a navmesh? ------> NavMesh myNavmesh = ??
How to access player? ------> ?? player = ??

Sorry if these are a beginner questions. I tried the "Find" method but I can't make it working.

Comments

  • Just make the variables in your script public.  They'll then be exposed in the Inspector for you to drag the Cutscenes onto them:

    public Cutscene myCutscene;

  • edited August 2014
    That would work if I was creating an action who calls another action, but I'm calling this action from the Menu System.cs.

    How could I call a cutscene from the menusystem.cs, OnElementClick method?

    (I need to call this action, each time I click on a cycle menu)
  • Oh, I see.  In that case, you can just call it by name:

    GameObject.Find ("MyCutscene").GetComponent <Cutscene>().Interact ();
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.