I have many different actions with "Play movie clip", and some of them use the same clip (the same video is suitable for different situations).
And when I update the original video file -- I need to go through all the actions and find where I need to replace it with a new one.
I came to the solution of using arrays referenced by the action (Object: Call event -> Cutscene gameobject -> my play method -> int with an index for the array), so I can specify the int once and replace the video only in the array, which is much more convenient and reduces risks.
But now the catch is that after some actions I have a scene change. And the object action doesnt have the "Wait until finish?" function needed for the video.
This can be bypassed by creating a variable in the script (IsVideoPlaying) and in the actions I can run the cycle "if IsVideoPlaying true then wait, else continue".
Plus, there is a nuance with the fact that AC's UI is now on top of the video, and there is no "Order layer" in the gameobject with the player.
In addition, there are many subtleties associated with the strange behavior of the Unity video player, but let’s leave that out for now. AC's player works perfectly and therefore I would like to use it.
At this point, everything I listed above begins to seem wrong cause it seems like I'm complicating something simple.
And I had a thought: maybe there is some simple way to send to Engine:Play movie clip - not a specific clip, but a link to a clip from an array? Because "Play movie clip" is ideal for my tasks, with the exception of this task with flexible file replacement from one source.
I think one of the solutions is: be able to add videos to an array inside AC Game Editor, from which the "play movie" action could take data.
Or is there already exist another and more correct solution?
I'm using:
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
What's the fundamental issue at play here? That the act of wanting to replace which video is played means updating multiple Actions in the same way?
If you have a situation where the same video clip is being played at multiple times, you can create a dedicated ActionList asset file that just has the Engine: Play movie clip Action, with Wait until finish? checked. Then, whenever you want to play that clip, instead use the ActionList: Run Action to run this asset file.
That way, if you want to change which clip that asset references, you only need to update that single instance of the Engine: Play movie clip Action.
Thanks for the answer! Yes, this solution works!
I moved the video player to a prefab so that it would be added to each scene.
My ActionList looks like this:
Also I added the SetMainCamera script to the prefab so that everything would work correctly in each scene. Roughly speaking:
I tested it and everything works well with this approach.
Thanks again!