Table of Contents

Class UtilityModule

Namespace
Titipi.MocaLib2

Shared helpers used internally by all MocaLib2 modules. Provides structured logging, platform identification, app version access, locale detection, device-tier classification, and IAP receipt parsing. Always available — no define guard required.

public static class UtilityModule
Inheritance
UtilityModule
Inherited Members

Properties

IsLowEndDevice

Convenience check for Low using the default RAM cutoff. Handy as a keyOverride selector for Resolve<T>(T, string) — e.g. serving a variant config to low-RAM devices.

Methods

DelayedCallAsync(float, Action, bool)

Invokes callback after delay seconds. When ignoreTimeScale is true (default), the wait is based on real time so it is unaffected by Time.timeScale pausing or slow-motion. When false, Unity's scaled time is used via Awaitable.WaitForSecondsAsync.

GetAndroidReceiptSignature(string)

Parses a Unity IAP receipt string (from order.Info.Receipt) for an Android purchase and returns the Google Play signature.

GetAppBuildNumber()

Returns the application build number string defined in GameVersionInfo.BUILD_NUMBER.

GetAppVersion()

Returns the application version string defined in GameVersionInfo.BUILD_VERSION.

GetDeviceLocale()

Returns the device's two-letter ISO 3166 region code (e.g. "US", "TH").

GetDeviceTier(int, int)

Classifies the device into a DeviceTier from its system RAM (SystemInfo.systemMemorySize, in MB). Note: on Android this under-reports physical RAM (OS-reserved memory is excluded), so a nominally 4GB device often reports ~3600MB — the default cutoffs account for that.

GetIOSReceiptPayload(string)

Parses a Unity IAP receipt string (from order.Info.Receipt) for an iOS purchase and returns the raw StoreKit receipt payload.

GetPlatformFriendlyName()

Returns a human-readable platform name for the current runtime (e.g. "Android", "iOS", "Unity Editor (macOS)").

GetUTCString()

Returns the device's UTC offset as a formatted string (e.g. "UTC+7", "UTC-5:30").

Is_iOS_14_5_Or_Higher()

Returns true when running on iOS 14.5 or later. Always false in the editor and on non-iOS platforms.

Is_iOS_17_Or_Higher()

Returns true when running on iOS 17 or later. Always false in the editor and on non-iOS platforms.

MocaLib2Log(string, string)

Logs an informational message prefixed with the MocaLib2 tag and the given module tag.

MocaLib2LogError(string, string)

Logs an error message prefixed with the MocaLib2 tag and the given module tag.

MocaLib2LogWarning(string, string)

Logs a warning message prefixed with the MocaLib2 tag and the given module tag.

NormalizeTrackingEventName(string)

Normalizes an event name to snake_case, stripping non-alphanumeric characters. Used to produce consistent event names across analytics SDKs.

RunInBackground(Func<Awaitable>)

Runs an async operation fire-and-forget: returns immediately without blocking the caller, and any exception thrown by work is caught and logged instead of being left unobserved. This is the one sanctioned place for async void in MocaLib2 — use it for background work whose completion the caller does not need to await (e.g. warming up the ad SDK during startup without blocking the loading screen).