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