{"id":1515,"date":"2020-03-29T16:31:35","date_gmt":"2020-03-29T08:31:35","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=1515"},"modified":"2020-04-18T08:53:41","modified_gmt":"2020-04-18T00:53:41","slug":"ue%e4%bd%bf%e7%94%a8%e6%97%a5%e5%bf%97","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=1515","title":{"rendered":"[UE]\u65e5\u5fd7"},"content":{"rendered":"\n<p>\u6dfb\u52a0\u81ea\u5b9a\u4e49\u7684Log\u7c7b\u578b\uff1a<br><br>\u5728.h \u6587\u4ef6\u4e2d\uff0c\u586b\u5199\u5982\u4e0b\u4ee3\u7801\uff1a<br>DECLARE_LOG_CATEGORY_EXTERN(YourLog, Log, All);<br><br>\u5728.cpp\u6587\u4ef6\u4e2d\uff0c\u586b\u5199\u5982\u4e0b\u4ee3\u7801\uff1a<br>DEFINE_LOG_CATEGORY(YourLog);<\/p>\n\n\n\n<p>\u8f93\u51fa\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>UE_LOG(LogTemp, Warning, TEXT(\"Problem on load Province Message!\"));\nUE_LOG(LogTemp, Warning, TEXT(\"Content:%s\"), *(Response->GetContentAsString()));\nUE_LOG(CategoryName,Warning,TEXT(\"MyCharacter's Health is %d\"), MyCharacter->Health );\nUE_LOG(CategoryName,Warning,TEXT(\"MyCharacter's Health is %f\"), MyCharacter->Health );\nUE_LOG(CategoryName,Warning,TEXT(\"MyCharacter's Name is %s\"), *MyCharacter->GetName() );<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>GEngine->AddOnScreenDebugMessage(-1,\u00a05.f,\u00a0FColor::Blue,\u00a0TestHUDString);\n\nGEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, FString::Printf(TEXT(\"Some variable values: x: %d, y: %d\"), HitX, HitY) )\n\nGEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Orange, FString::Printf(TEXT(\"My Location is: %s\"), *GetActorLocation().ToString()));<\/code><\/pre>\n\n\n\n<p> \u5728\u6e38\u620f\u6a21\u5f0f\u4e0b\uff0c\u4f60\u9700\u8981\u5728\u6e38\u620f\u7684\u5feb\u6377\u65b9\u5f0f\u540e\u9762\u52a0 -Log\uff0c\u624d\u4f1a\u5728\u6e38\u620f\u4e2d\u663e\u793a\u3002<\/p>\n\n\n\n<p>\u7f16\u8f91\u5668\u6a21\u5f0f\uff08Play In Editor\uff09\uff1a<br> \u53ef\u4ee5\u5728Output\u7a97\u53e3\u4e2d\u770b\u5230log\u4fe1\u606f\u3002<br>\u5982\u679c\u60f3\u5728\u6e38\u620f\u4e2d\u770b\u5230\uff0c\u9700\u8981\u5230Engin.ini\u4e2d\u4fee\u6539\u53c2\u6570\u6dfb\u52a0&#8221;GameCommandLine=-log\uff0c\u5982\u679c\u6ca1\u6709\uff0c\u5219\u9700\u8981\u6309~\uff0c\u8f93\u5165-Log\u547d\u4ee4\u5f00\u542f\u3002<br>\u5feb\u901f\u4f7f\u7528\uff1aUE_LOG(LogTemp, Warning, TEXT(&#8220;Your message&#8221;));<br>\u4e0d\u7528\u8bbe\u7f6e\u6807\u7b7e\uff0c\u7b80\u5355\u5feb\u901f\u3002<\/p>\n\n\n\n<p> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6dfb\u52a0\u81ea\u5b9a\u4e49\u7684Log\u7c7b\u578b\uff1a \u5728.h \u6587\u4ef6\u4e2d\uff0c\u586b\u5199\u5982\u4e0b\u4ee3\u7801\uff1aDECLARE_LOG_CATEGORY_EXTERN [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1515"}],"collection":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1515"}],"version-history":[{"count":3,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1515\/revisions"}],"predecessor-version":[{"id":1810,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1515\/revisions\/1810"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}