繁体   English   中英

如何在Unity3D的ac ## error预处理器中打印URL?

[英]How to print an URL in a c# #error preprocessor in Unity3D?

我正在写一些Unity模块。

它们中的一些相互依赖,所以我想打印出一个错误,包括URL到哪里得到丢失的模块。

我试过这个:

#if !THIS_MODULE
#define THIS_MODULE
#endif

#if !REQUIRED_MODULE
#error This Module requires the RequiredModule module
#error Please get it from "https://example.com"
#endif

如果缺少所需的模块,则第一行只是按预期在Unity3D控制台中打印出来

error CS1029: #error: 'This Module requires the RequiredModule module'

但第二行只打印

error CS1029: #error: 'Please get it from "https:'

  • 我试着和没有"'

    除了在输出中添加"' ,这不会改变任何东西

  • 我试过了

     #error Please get it from "https:\\/\\/example.com" 

    但比它打印

     #error: 'Please get it from "https:\\/\\/example.com"' 

如何使用Unity中的#error预处理器严格打印URL?

我有什么逃避规则吗?

你根本不需要任何逃避。 在线演示 。)

#error / #warning指令的消息(基本上)是指令之后和行结束之前的任何内容。 编译器源中记录了此行为。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM