- Home /
how to execute two line of code simultaneously.???
hi
i have two movie textures.. MainTexture MaskTexture
when i play this two movie textures.
maintexture.Play();
masktexture.Play();
i am getting delay in playing second masktexture. so how can i execute both texture simultaneously.. ???
plz help
A single thread cannot execute two lines of code simultaneously. That's simply not possible.
$$anonymous$$ultiple threads do execute code simultaneously, but Unity is not threadsafe, and the movie texture is part of the Unity API.
The answer to this problem should be found elsewhere - there must be another reason you experience this delay. Perhaps it's doing some kind of pre-loading or buffering. In any case, there is no rendering of frames in between two directly consecutive lines of code where you get to visibly experience a delay between the lines. If one call to .Play takes long to return before it gets to the next call to .Play, you would see it as your app freezing, not one video delaying.
Although it is not possible to execute two lines simultaneously, in fact they are executed with such a small delay that you can not notice it, so the problem is with something else.
What the rest said. If you have both lines in the same script, in the same function one right after the other, then they are executed in the same frame. (Or at least their execution is started the same frame.)
Are the movies the same format? Is one more compressed than the other?
As matey says above, the delay is the time of loading/buffering the first frame of the video.
Get them pre-loaded way before play.
Your answer
Follow this Question
Related Questions
Video Import failure after Unity update [5.4.1p1] 0 Answers
Short looping videos on Mobile platforms 0 Answers
How to play Alpha video in unity ? 4 Answers
Play, seek a video 1 Answer
Converting a video to a material 1 Answer