In my unity project I have huge number of textures(frames) as assets. Around ten thousand. Basically these are collection of frames from a video shoot. If I try to use Resource.Load() for all of these frames in start() method then my unity project takes almost 5/7 minutes to run. So, this approach is not fruitful at all.
Analog electrical signals are coming from two Steppers (left and right) and the Unity is processing them. When the signal is detected from the Stepper I will have move forward 15(size of each step) frames at a time.
To do this kind of operation I have defined an array of size 15. Now in the start() method I load this array by first fifteen frames from my resource directory.
Now suppose the signal comes from the left Stepper, which is captured in update() method. In the FixedUpdate() I traverse this Array and render the frames one by one. After rendering I clear this array with Array.Clear(…) and load it with next 15 frames.
So when the next signal comes from the right stepper - these frames from the Array are also rendered one by one. So far so good.
The problem is - when the Stepper speed gets bit higher it sends signal more frequently and as a result Unity crashes.
What would be more efficient way to tackle this kind of scenario.
Should I use two Arrays (one for left, one for right) so that there is considerable lag. I’m trying to keep the solution simple in the sense that I’m assuming left-right-left-right…Stepper sequence for the time being.