-
-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support asmdef Root Namespace option #228
Support asmdef Root Namespace option #228
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/hadashia/vcontainer/55bRpPqGKfSwMkKVqWyhdKB55Ekm |
内容は 👍 です。ありがとうございます。
Unityのバージョンによって差異がでた場合の検知や保守が少し不安です 🤔 この機能については、ユーザが自由に書いたテンプレートに対応する必要はなく、 ( 元のメソッドは あらゆる改行コードやインデント状況に対応していますが、最初から 行のList をキメ打ちで用意してしまうとかでも良いかな- など |
保守面でのコストやテンプレが固定であり最低限の機能があれば良い点などおっしゃる通りだと思いますので、こちら対応いたします 🙇 |
このような形に簡略化してみました 🙇 |
AssetDatabase.Refresh(); | ||
for (var i = startAt + 1; i < endAt; ++i) | ||
{ | ||
lines[i] = $" {lines[i]}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
現在のテンプレートには空行が存在しないので 空行チェック は省きました
ありがとうございます 👍 |
Unity 2020.2よりアセンブリ定義ファイルに
Root Namespace
オプションと、それに対応する#ROOTNAMESPACEBEGIN#
/#ROOTNAMESPACEEND#
というスクリプトテンプレート向けのキーワードが追加されており、LifetimeScope
のテンプレートコードでも対応できたらと思いPRを作成させていただきました。👇
internal
な Unity API が必要なためリフレクションを使用しておりますが、こちらが問題になりそうであれば このコミット だけでも取り入れていただければと思います 🙇 (先にやる必要のない文字列処理を後で行うように変更いたしました)※リフレクションを避けるためにスクリプトテンプレートをどこかに配置して
ProjectWindowUtil. CreateScriptAssetFromTemplateFile
を使うような形も検討しましたが、余計なファイルが増えてしまうため現在の形で対応いたしました。