getRuntimeFeatures
Get Runtime Feature List
getRuntimeFeatures is a class method of the SUDRT protocol. It returns the set of features supported by the current game engine (Runtime). Since the capabilities supported by different SDK versions or different engine kernels (such as 2D vs 3D) may differ, developers can use this method to dynamically determine at runtime whether the current environment has certain advanced capabilities.
Method Declaration
objectivec
/**
* Returns the list of functions or features supported by the current Runtime.
* @return An array containing feature identifier strings, or nil if no special features are supported.
*/
+ (nullable NSArray<NSString *> *)getRuntimeFeatures;Runtime Behavior
- Feature detection: Returns a set of predefined constant strings (such as
"feature.video_player","feature.webgl2","feature.file_system", etc.). - Version decoupling: Allows the host App to decide whether to enable certain business logic by checking the feature list, without upgrading the SDK.
- Static query: As a class method, it can be called at any time before engine initialization, for pre-checking the environment.
Code Example
Before calling a specific API, first check whether the engine supports that feature:
objectivec
// 1. Get the list of supported features
NSArray<NSString *> *features = [SudRuntimeImpl getRuntimeFeatures];
// 2. Check whether the high-performance rendering mode is supported
if ([features containsObject:@"feature.high_performance_canvas"]) {
NSLog(@"[SUD] The engine supports high-performance canvas, enabling 120fps mode");
[self enableUltraMode];
} else {
NSLog(@"[SUD] The current engine does not support this feature, falling back");
}Notes
- Null handling: If it returns
nilor an empty array, it usually means the current engine is the basic version and only supports the core mini-game runtime capabilities. - Not a business switch: This list reflects the underlying technical capabilities of the engine, not App-layer business switches (business switches should be injected via
setGameStartOptions:options:). - Forward compatibility: When writing code, be sure to perform a
containsObject:check for newer Features, to prevent logic exceptions when running on older SDK versions.
