{"id":2477,"date":"2025-11-20T19:27:12","date_gmt":"2025-11-20T19:27:12","guid":{"rendered":"https:\/\/golemitegames.com\/?post_type=docs&#038;p=2477"},"modified":"2025-11-21T21:36:27","modified_gmt":"2025-11-21T21:36:27","password":"","slug":"timer","status":"publish","type":"docs","link":"https:\/\/golemitegames.com\/index.php\/docs\/timer\/","title":{"rendered":"Timer"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Introduction<\/h2>\n\n\n\n<p>This component is solely used in the <a href=\"https:\/\/golemitegames.com\/index.php\/docs\/crafter\/\" title=\"Crafter\">Crafter<\/a> component. It does not rely on other components from this system however, so you could use this Timer class for any other logic that would require a Timer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Setting up<\/h2>\n\n\n\n<p>Setting up just requires adding this component to a gameobject.<br><a href=\"https:\/\/golemitegames.com\/index.php\/docs\/crafter\/\" title=\"Crafter\">Crafter<\/a> will automatically add this component to the gameobject.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Settings<\/h2>\n\n\n\n<p><strong>Mode<\/strong><br>Count Down &#8211; Counts the Timer down from the set time. <br><br>Count Up &#8211; Counts the Timer Up from 0 to the set time. <br><br><strong>Display Format<\/strong><br>Seconds &#8211; Only display seconds.<br><br>MinutesSeconds &#8211; Display Minutes and Seconds.<br><br>HoursMinutesSeconds &#8211; Display Hours, Minutes and Seconds.<br><br>Detailed &#8211; Displays the characters such as 5h : 24m : 15s. This mode can also hide leading zeros when the time is less. For example if the total time was 1 hour and 45 minutes, when below an hour it would show 59m : 59s and not 0h : 59m : 59s. <br><br><strong>Show Milliseconds<\/strong><br>Display the Milliseconds, this applies to all modes except detailed. <br><br><strong>Hide Leading Zeros<\/strong><br>In Detailed mode, hide the characters that are equal to 0. For example if the total time was 1 hour and 45 minutes, when below an hour it would show 59m : 59s and not 0h : 59m : 59s. <br><br><strong>Time Splitter<\/strong><br>Which character to put in between the time segments. Such as : or \/. <br><br><strong>Time Text<\/strong><br>Assign a TextMeshProUGUI component to display the current time. <br><br><strong>Fill Image<\/strong><br>Assign an Image component to display the current time using the fill.  <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Event<\/h2>\n\n\n\n<p><strong>On Timer Complete Event<\/strong><br>Triggers when the Timer has finished<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" style=\"font-size:22px;text-transform:capitalize\">Scripting<\/h2>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-csharp\" data-lang=\"C#\" data-show-lang=\"0\"><code>\/\/Action\n\n\/\/Triggers when the Timer has finished\n\/\/public Action OnTimerCompleteAction;\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Initialise the Timer without starting it. This will also refresh the UI\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;duration&quot;&gt;&lt;\/param&gt;\npublic void InitTimer(float duration)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Start the timer with a given duration\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;duration&quot;&gt;The duration of the timer&lt;\/param&gt;\npublic void StartTimer(float duration)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Start the timer midway through, with a given duration, and current value\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;duration&quot;&gt;The duration of the timer&lt;\/param&gt;\n\/\/\/ &lt;param name=&quot;current&quot;&gt;The current value the timer should start at&lt;\/param&gt;\npublic void StartTimerMidway(float duration, float current)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Stop the timer and reset it\n\/\/\/ &lt;\/summary&gt;\npublic void StopTimer()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Pauses the timer\n\/\/\/ &lt;\/summary&gt;\npublic void PauseTimer()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Resumes the timer\n\/\/\/ &lt;\/summary&gt;\npublic void ResumeTimer()\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Hide and Unhide the text displaying object\n\/\/\/ &lt;\/summary&gt;\n\/\/\/ &lt;param name=&quot;display&quot;&gt;&lt;\/param&gt;\npublic void DisplayTextObject(bool display)\n\n\/\/\/ &lt;summary&gt;\n\/\/\/ Refresh the time UI\n\/\/\/ &lt;\/summary&gt;\npublic void UpdateUI()<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction This component is solely used in the Crafter component. It does not rely on other components from this system however, so you could use this Timer class for any other logic that would require a Timer. Setting up Setting up just requires adding this component to a gameobject.Crafter will automatically add this component to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"doc_category":[46],"doc_tag":[],"class_list":["post-2477","docs","type-docs","status-publish","hentry","doc_category-resource-and-production"],"acf":[],"aioseo_notices":[],"year_month":"2026-04","word_count":455,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"rickitz5h","author_nicename":"rickitz5h","author_url":"https:\/\/golemitegames.com\/index.php\/author\/rickitz5h\/"},"doc_category_info":[{"term_name":"Resource And Production","term_url":"https:\/\/golemitegames.com\/index.php\/docs-category\/resource-and-production\/"}],"doc_tag_info":[],"_links":{"self":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2477","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/comments?post=2477"}],"version-history":[{"count":3,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2477\/revisions"}],"predecessor-version":[{"id":2582,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/docs\/2477\/revisions\/2582"}],"wp:attachment":[{"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/media?parent=2477"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_category?post=2477"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/golemitegames.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=2477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}