PlaceholderGames / 2022-yr2-team-gemini

Second CS2S561 Game
0 stars 0 forks source link

VictorsBranch Update #7 (Timer) #29

Closed 30001606VA closed 2 years ago

30001606VA commented 2 years ago

I added a timer to my branch:

image

image

There's only one problem that I can't figure out. Because of the fact that we have two different displays, I can't get the same timer working on the Terminal cameras. If I put a canvas and a timer on each camera, then every time I switch between the cameras the timer will be de-synced because that camera is being deactivated and therefore pausing the timer.

I think the solution might have to be to change the way you switch cameras, but I'm gonna find out. If anyone else wants to find another solution please tell me if you find it.

30001606VA commented 2 years ago

So I solved the issue of not being able to have the same timer on multiple cameras.

It was what I thought it was, because the way we were switching between the cameras was by using the function - .SetActive(True)/.SetActive(False), which would enable and disable not only the camera but the objects connected to it too. This means that if we had scripts for timers on the cameras, those timers would stop because they were set to not be active while the Robot timer would keep going, therefore de-syncing the timers.

I looked around for different ways to switch cameras, and found one eventually, instead of using .SetActive(), we now use camx.enabled = true/false:

image

This way, it doesn't deactivate the scripts and we can still switch between cameras without de-syncing the timers. There's one issue with this approach which I despise, and that's the fact that it adds extra steps if we want to add another camera. Now we have to add it doing these steps:

image

In the future I'm going to experiment to see if there's a simpler way to add cameras, but as for now it's going to have to be like this.

30001606VA commented 2 years ago

Closing this for documentation