Hey thank you so much, I couldn't figure out how to make a if statement with strings but this video help me a huge ton and save me some much time. Thank you
@lukegamrivella21014 ай бұрын
Thanks for the tutorial! Quick question, how will I keep record of my time across different scenes ? Won't the time reset to 00:00 when switching scenes ?
@simulation31202 жыл бұрын
I wish I could have seen your inspector on TimeText, but overall much appreciated and helpful.
@xil23313 жыл бұрын
This is so cool and helpful! Loving this content!
@HannaOkonenko9 ай бұрын
Thanks for your great job! tell me please what can be wrong if i see 11:60 not 11:00?
@damdakos3 жыл бұрын
Great tutorial. I learned a lot. Thanks.
@neekitsart3 жыл бұрын
Thank you so much I've been struggling to find any useful tutorials about this
@danutorr Жыл бұрын
Fantastic vids, this and the previous one as well!
@boycececil37273 жыл бұрын
Great JOB!!! THX a lot, keep going !
@deepandrence46053 жыл бұрын
Thanks a lot. You helped me a lot more than many videos and blogs. Thanks again.
@finalrenderanimationstudio3 жыл бұрын
Each time I think of systems not usually explored, shortly after I see you covering something Abt it, truly this was a great video,learnt alot too! Lol, got me thinking what's next? 😄
@ogulcanzorlu3 жыл бұрын
Great practical example on Actions.
@Kriskopower2 жыл бұрын
Thanks. I do however have a problem. I tried to use this to implement day and night cycle in my project. Simply if the hour is 20 (20:00pm) i begin to decrease the RGB values of my SpriteRenderer image so it becomes darker. Then i check if the hour is 4 (04:00am) for example and i begin to slowly increase the same RGB values back to 255 to kinda simulate sunrise. It works fine and looks nice but after the first cycle it just doesnt happen anymore. Clock keep ticking like normal but my checks never get checked again and i dont know why :( I have added the same line as you added for the minute : "If the minute is >= 60 we reset it to 0 and we increment Hour by 1: hour++" but i added the same line for hour so if the hour >= 24 i say Hour = 0. So yeah the text clock appears to count normally but my checks only happens once for the first cycle and never again and i dont know why. Can you please help me with that ?!
@Wilhelm92182 жыл бұрын
Were you ever able to get it working? I’m having some difficulties as well. Are you calling your methods that decrease the values in an update function? My guess is that they are just being called once instead of in update where they would be checked every frame?
@archanachaurasia78112 жыл бұрын
Sir can you make the day night cycle using this time manager. It would be a great help
@marto5615 ай бұрын
Just brilliant!
@bluebaldwin3 жыл бұрын
Really great tutorial and explanation! Keep it up pal 🤙 cheers
@pietro0games3 жыл бұрын
I thought about doing something like this, thanks for proving it
@Andrew-mg3ib2 жыл бұрын
I think using DateTime and TimeSpan solves the redundancy of making your own time structures. And then you just change the update loop to add a minute every time an in-game minute passes. And then call a method that checks if hours, days, months, years have changed which fires events. If you wanted to handle days and months, you'd have to rewrite the complex code to do so, not to mention doing time calculations if you want to progress time.
@Kriskopower2 жыл бұрын
Please can you help me with that...if you have the time to explain me the details in creating such a system of course. I would appreciate it very much.
@Andrew-mg3ib2 жыл бұрын
@@Kriskopower Google those c# structs. There's lots of documentation on them. Way more robust with lots of problems already solved. Was surprised he didnt just use them.
@Kriskopower2 жыл бұрын
yup, yesterday i researched the DateTime built in struct and i made it work easily in my game. Just using the AddMinutes method and updating each frame accordingly.Also i really liked that the constructor is really rich, giving you the opportunity to define w/e time you need. Pretty neat :)
@ThePancakeJedi3 жыл бұрын
Wouldn't it kill performance by invoking an event every (half) second?
@christinaVennegerts3 жыл бұрын
Amazing Tutorial, thank you very much!
@breecebossy8435 Жыл бұрын
Thanks. I love the simplicity and versatility. I found that if I subscribe to hour and minute changed, then set something to happen at 6 && 0 (respectively), the method will execute on start, regardless of the hour condition not being met, as the 0 minute condition is instantly met. I fixed this by unsubscribing for minutes. Have I misused the system, or am i using it as it should be used?
@charg1nmalaz0r51 Жыл бұрын
You were using it wrong. What is happening when the minute event riggers is anything subscibed to that minute event will run its function, same with the second event. If you hook up one function to two different events it will fire whenener those events fire. What you could do is sign it up to a timechanged event which passes the listener a struct that contains all the time information then you can check on your object when the time changes is the hour and minute 60 if so do this.
3 жыл бұрын
Impressive tutorial. Thank you for help.
@SkylorBeck3 жыл бұрын
Interesting way to do it. I personally prefer using an unsigned int or double, then increment it by one every fixed update. Then each fixed update just check to see if the current tick count is remainder 0 for your fixed update interval and increment another uint (or double) that represents seconds. Now you have a timer for ticks and a timer for seconds. You can remainder at different speeds to change your in game clock speed as well.
@KevsArtStuff3 жыл бұрын
Awesome... need to get my head around Actions, but still, great video... thanks and subbed :)
@comp3interactive3 жыл бұрын
I do actually have another video on my channel soully about Actions that you might find interesting!
@Vichroma2 жыл бұрын
question: i did the code but the update function literally does not work. i tried everything and it just doesn't run. the start function works just fine. any idea what could be causing this?
@lordlemonhead27323 жыл бұрын
If I let my player walk into another scene, does the time continue where it left off or will it restart at its coded starting point?
@Definitely_a_Fox2 жыл бұрын
A little late to the party but it would most likely restart. A simple way to make sure it continues is to make sure the object that keeps track of the time doesn't get deloaded when a new scene is loaded in. Simply add this line; DontDestroyOnLoad(this.gameObject); and it'll persist! I believe that the time will continue to tick on during loads, but I haven't tested it myself to make sure. Just make sure that you only ever have one of these time management objects in your scene at once, or it will cause some funky behaviour.
@elite_ramsay16672 жыл бұрын
I was wondering how would i make it so on a button to pause the timer and one to resume the timer
@Wilhelm92182 жыл бұрын
I tried this and for some reason it the clock just keeps going up constantly per frame, regardless of what I set as the float (like in the example 0.5).
@astronuggie3 жыл бұрын
When I drag the TimeUI script to my clock object which is text, it says The script doesn't inherit a native class that can manage a script. I'm trying to only have in game time, not have it trigger actions yet. I can drag TimeManager but not UI
@mrmacka14562 жыл бұрын
What object is the TimeBlock?
@abdou0233 жыл бұрын
Is it okay to still subscribe and fire Actions if the script is on multiple GameObjects like an Enemy script would be on several enemies?
@jesseyules3 жыл бұрын
Q: What code would we need to trigger an animation using bool? (ie .SetBool("drive car", true);
@caracolina87853 жыл бұрын
Animator.SetBool("driving", true)
@mrmacka14562 жыл бұрын
It says "Can't add script component 'TimeUI' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name can be found". Does anyone know how to fix this problem?
@do_it_like_rei2 жыл бұрын
Same problem here with the time manager script
@do_it_like_rei2 жыл бұрын
I FINALLY GOT IT WORKING FOR US! Okay so first make sure you have "using System;" in the assemblies at the top of the page, under using UnityEngine, etc. For the UI, make sure you also put "using TMPro;" up there or else you can't hook up the text to the script in your clock. Also in your public class make sure it's the name of your script. The time manager script wasn't working for me because for some reason it was set as New Behavior.
@ia26044 ай бұрын
@@do_it_like_rei I was just getting hung up on this when your comment set me free. Many thank yous!
@epiphanyatnight87323 жыл бұрын
Awesome tutorial! Would you recommend using UnityEvent instead of Actions? I usually consider UntiyEvents to be simpler but would love to know why you chose actions.
@comp3interactive3 жыл бұрын
The benefits of using one over the other are mostly negligible, UnityEvents are slightly slower and come with more of an overhead, but they're visible in the inspector Personally I just use Actions coming from a non-gamedev C# background
@epiphanyatnight87323 жыл бұрын
@@comp3interactive Thanks for the reply, really helpful! Keep up the great work, I subbed!
@comp3interactive3 жыл бұрын
Thanks man! Hopefully there'll be some more stuff on the channel you find useful too!
@F0r3v3rT0m0rr0w2 жыл бұрын
Quick question, the clock has a jittery effect, What would be the best approach to stopping that ?
@comp3interactive2 жыл бұрын
You can use the tag to force monospace, that will stop the characters jumping around
@MrEastgalaxy2 жыл бұрын
damn some great tips.
@akaRDJC3 жыл бұрын
idk if anyone can help me here but i wanna display am and pm strings that appear when the counter reaches 12 hours, am not looking for spoon fed answer as i wanna figure it out myself but if anyone has a hint in the direction id need to go to solve it that would be nice
@xkittencatx3 жыл бұрын
Hi there! I only briefly glimpsed at the video, I'm in the process of rewatching it rn, but off the top of my head I would think that you'd make an if-else function checking if the hour counter is equal to 12 which would be P.M and then another function checking if the hour counter is equal to 24 A.M or vice versa. Basically, you'd be operating off of military time. But, I feel as if more people prefer the 12-Hour time set up we see on wall clocks and what not. In that case, I'd write some code that changes the 24 numerals back into the 12-Hour but changing the string to read P.M and A.M when necessary. I don't know if this helps or not but let me know!
@charg1nmalaz0r51 Жыл бұрын
just do something like : string ampm = (if hours > 12
@random_precision_software3 жыл бұрын
Can you tell me how much it cost for a sponsor please? Just asking for future reference for when I release my next game.
@comp3interactive3 жыл бұрын
Hi man. Thanks for inquiring. Currently I can't accept new sponsors for my videos as I'm already sponsored by GigaTank3000 and don't really want to hammer ads and sponsors on the videos and turn people away, but the rates I charge are on my patreon, the sponsor tier is £50 for a months worth (4) videos