ActionTimer

Library

This package provides a clean, updated interface for the community-standard Timer class.

FarawayRobot updated 6mo ago 0 MB engine 25
thumb_up 2 open_in_new View on sbox.game
ActionTimer

Action Timer

A high-performance, async timer utility for s&box. This package bridges the reliable community-standard Timer class with the modern Scene System, providing both a robust C# API and a designer-friendly Component.


Features
  • Static & Component-Based: Use Timer.Create in code or drop an ActionTimer component onto a GameObject.
  • Async & Threaded: Built on Task and CancellationToken for non-blocking delays.
  • State Control: Pause, Resume, Stop, or Adjust active timers via unique string IDs.
  • Visual Scripting: Trigger GameObjectEvents or Actions directly from the Inspector.
Usage

1. The ActionTimer Component

Add the ActionTimer component to any GameObject to trigger logic after a duration.
  • Duration: Time in seconds before the timer fires.
  • Timer Loops: If checked, the timer restarts immediately after firing.
  • Auto Start: If checked, the timer begins as soon as the component starts.
  • Use Threading: Offloads the timer loop to a background thread.
  • On Timer Elapsed: Hook up any method or event to fire when the time is up.
2. Static C# Methods

For pure code implementations, use the static Timer class.

Simple Delay

A "fire and forget" one-off delay.

C#
// Runs after 1 second on the main thread
Timer.Simple( 1.0f, () => Log.Info( "Time is up!" ) );

// Runs on a background thread
Timer.Simple( 1.0f, () => HeavyLogic(), threaded: true );

Managed Timer

Create a timer with an ID to track or manipulate it later.

C#
// Create a timer that repeats 10 times
Timer.Create( "health_regen", 1.0f, 10, () => Player.Heal( 5 ) );

// Check if it exists
if ( Timer.Exists( "health_regen" ) )
{
    Log.Info( $"Next tick in: {Timer.TimeLeft( "health_regen" )}" );
}

// Pause or Stop it
Timer.Pause( "health_regen" );
Timer.Remove( "health_regen" );


API Reference

MethodDescriptionSimple( delay, func, threaded ) | Fire and forget one-time delay.
Create( id, delay, reps, func, threaded ) | Create a tracked timer (reps: 0 = infinite).
Remove( id ) | Stops and disposes of a timer immediately.
Adjust( id, delay, reps, func ) | Change timer parameters on the fly.
Pause( id ) / UnPause( id ) | Suspends or resumes a timer.
TimeLeft( id ) | Returns float seconds remaining in current cycle.
RepsLeft( id ) | Returns remaining repetition count.

Credits

Based on the sbox-timer-lib originally maintained by the sbox.Community. Updated and wrapped for the Scene System by Farawayrobot.


If you would like to support more of my work you can subscribe at my Patreon: https://www.patreon.com/FarawayRobot
Or want to leave me a tip? You can do so at https://ko-fi.com/farawayrobot


No usage statistics available
This package may be new or not widely used yet. Usage data becomes available as more users install and play with the package.
0 recorded entries
Rank Player Score Recorded
refresh
Discovering package leaderboards...
Package ID: actuallyrobots.actaullyrobots
Created: 2026-04-13 18:31 UTC
Updated: 2026-04-14 04:23 UTC
Type: library
Public: Yes
Version: 198386
files: 10
Size: 0.0 MB
Engine Version: 25
Asset Version ID: 198386
Version Created: 2026-04-14 04:23 UTC
Hash: 772768378861244245
Manifest: Open manifest

more_horiz Additional Properties

Compiler: {"RootNamespace":"Sandbox","DefineConstants":"SANDBOX","NoWarn":"1701;1702;1591;","WarningsAsErrors":"","TreatWarningsAsErrors":false,"Nullables":false,"ReleaseMode":"Release","AssemblyReferences":[],"ReplacementDirectives":{".Server.cs":"SERVER"},"IgnoreFolders":["editor","unittest"],"DistinctAssemblyReferences":[]}
new_releases Latest Update Apr 14, 2026
Changes on 2026-04-14
198386 Apr 14, 2026
Changes on 2026-04-14
198312 Apr 14, 2026
Changes on 2026-04-14
198311 Apr 14, 2026
Changes on 2026-04-14
198305 Apr 14, 2026
Changes on 2026-04-14
198199 Apr 13, 2026
Changes on 2026-04-13
198024 Apr 13, 2026
Changes on 2026-04-13
198022 Apr 13, 2026
Changes on 2026-04-13
198005 Apr 13, 2026
Changes on 2026-04-13
info Live API Passthrough & Removal Notice

This file manifest and asset metadata are retrieved live directly from the official Facepunch s&box public API. s&box Explorer does not host, store, or redistribute any package files. All download links route directly to Facepunch CDN servers.