Mike's Log: Week 11
- Mike Toronto
- May 21, 2017
- 1 min read
For the ATP/GTP shooter there was a really weird bug that took me awhile to figure out. Whenever I would attach an ATP or a GTP to an enzyme there would be a really noticeable lag spike, at first I thought it was something that I was doing to cause the problem however I figured out it was a Unity thing. Unity has this optimization where it won’t load assets unless they are needed. And my game would Instantiate some particles when the molecules would attach to the enzyme. Because this is the first time my game would play these assets Unity needs to take the time to load them, and this would result in a lag spike. What most games do for this is to load the necessary assets behind a loading screen, this works but I found an even better method, and that’s to create an inactive camera and load the assets when I need them, that way I can control the load data, and load the assets when at a certain time so the lag spike isn’t during gameplay.
I was able to add set the timer up correctly, not when molecules attach to enzymes there is a little bonus time added so the player can play a little longer.
There are still a few bugs that I need to work out, such as certain cases when the game wont transition to the correct level or phase.
Michael Toronto
Comentarios