【UE4 C++】Print、Delay、ConsoleCommand

66 篇文章 6 订阅

基于UKismetSystemLibrary

PrintString

/**
 * Prints a string to the log, and optionally, to the screen
 * If Print To Log is true, it will be visible in the Output Log window.  Otherwise it will be logged only as 'Verbose', so it generally won't show up.
 */
UFUNCTION(BlueprintCallable, meta=(WorldContext="WorldContextObject", CallableWithoutWorldContext, Keywords = "log print", AdvancedDisplay = "2", DevelopmentOnly), Category="Utilities|String")
static void PrintString(const UObject* WorldContextObject, const FString& InString = FString(TEXT("Hello")), bool bPrintToScreen = true, bool bPrintToLog = true, FLinearColor TextColor = FLinearColor(0.0, 0.66, 1.0), float Duration = 2.f);

/**
 * Prints text to the log, and optionally, to the screen
 * If Print To Log is true, it will be visible in the Output Log window.  Otherwise it will be logged only as 'Verbose', so it generally won't show up.
 */
UFUNCTION(BlueprintCallable, meta=(WorldContext="WorldContextObject", CallableWithoutWorldContext, Keywords = "log", AdvancedDisplay = "2", DevelopmentOnly), Category="Utilities|Text")
static void PrintText(const UObject* WorldContextObject, const FText InText = INVTEXT("Hello"), bool bPrintToScreen = true, bool bPrintToLog = true, FLinearColor TextColor = FLinearColor(0.0, 0.66, 1.0), float Duration = 2.f);

/**
 * Prints a warning string to the log and the screen. Meant to be used as a way to inform the user that they misused the node.
 * WARNING!! Don't change the signature of this function without fixing up all nodes using it in the compiler
 * @param	InString		The string to log out
 */
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "TRUE"))
static void PrintWarning(const FString& InString);

Delay

/** 
 * Perform a latent action with a delay (specified in seconds).  Calling again while it is counting down will be ignored.
 */
UFUNCTION(BlueprintCallable, Category="Utilities|FlowControl", meta=(Latent, WorldContext="WorldContextObject", LatentInfo="LatentInfo", Duration="0.2", Keywords="sleep"))
static void	Delay(const UObject* WorldContextObject, float Duration, struct FLatentActionInfo LatentInfo );

/** 
 * Perform a latent action with a retriggerable delay (specified in seconds).  Calling again while it is counting down will reset the countdown to Duration.
 */
UFUNCTION(BlueprintCallable, meta=(Latent, LatentInfo="LatentInfo", WorldContext="WorldContextObject", Duration="0.2", Keywords="sleep"), Category="Utilities|FlowControl")
static void RetriggerableDelay(const UObject* WorldContextObject, float Duration, FLatentActionInfo LatentInfo);

ConsoleCommand

  • ConsoleCommand

    GetWorld()->GetFirstPlayerController()->ConsoleCommand(TEXT("Quit"));
    
  • ExecuteConsoleCommand

    /**
     * Executes a console command, optionally on a specific controller
     */
    UFUNCTION(BlueprintCallable, Category="Development",meta=(WorldContext="WorldContextObject"))
    static void ExecuteConsoleCommand(const UObject* WorldContextObject, const FString& Command, class APlayerController* SpecificPlayer = NULL );
    
  • 其他

    /**
     * Attempts to retrieve the value of the specified float console variable, if it exists.
     */
    UFUNCTION(BlueprintCallable, Category="Development")
    static float GetConsoleVariableFloatValue(const FString& VariableName);
    
    /**
     * Attempts to retrieve the value of the specified integer console variable, if it exists.
     */
    UFUNCTION(BlueprintCallable, Category="Development")
    static int32 GetConsoleVariableIntValue(const FString& VariableName);
    
    /**
     * Evaluates, if it exists, whether the specified integer console variable has a non-zero value (true) or not (false).
     */
    UFUNCTION(BlueprintCallable, Category="Development")
    static bool GetConsoleVariableBoolValue(const FString& VariableName);
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值