2015年7月29日水曜日

[Visual Studio] .shader, .compute, .cgincのシンタックスハイライト/カラーリング

ネタ元
http://forum.unity3d.com/threads/tutorial-how-to-use-nshader-with-unity-shaders.108995/

〇 Visual Studio 2013
S-edさんが添付している $NShader.zip に格納されている
NShader.vsix をダブルクリックしてインストール。

〇 Visual Studio 2015
samizzoさんがリンクを張っている NShader_2015.zip に格納されている
NShader.vsix をダブルクリックしてインストール。
※ 自分は2015は入れてないので試してないのですが、
Enterprise版で動かない、Community版では動いたというコメントが返ってきているみたいです。



NShader は HLSL, GLSL, Cg で書かれたファイルをハイライト/カラーリングしてくれるVisual Studio 2008/2010 の拡張みたい。

NShader
http://nshader.codeplex.com/

S-edさん、samizzo さんのはNShaderをさらに拡張させているみたいですね。


……よくわからず書いてるから歯切れが悪い!

2015年7月27日月曜日

C# 多次元配列の初期化,ゼロクリア速度の比較

多次元配列を初期化(ゼロクリア)するのにかかる処理時間を計測した。
厳密にはUnityの話ではないのだろうけど、Unity上で行った。
 

[Unity] unsafeコードの動かし方


手順1.
 Visual Studioの場合、 Project > Property > Build > Allow unsafe code にチェックを入れる。

手順2.
 Assetsフォルダ直下にsmcs.rspとgmcs.rspを作成する。
   どちらも中身は -unsafe とだけ入力する。

手順3.
 UnityのEdit > Project Settings > Player を開き、
 Other Settings > Configuration > Scripting Define Symbols の欄に unsafe と入力しEnter。



Reference Sites
http://forum.unity3d.com/threads/how-do-i-enable-unsafe-code.210781/
https://github.com/Banbury/UnityPsdImporter/issues/9
http://anchan828.tumblr.com/post/32669868103/define


※補足
Scripting Define Symbols の下にある項目、Api Compatibility Level が
.NET 2.0 Subset の場合、smcs.rspだけ
.NET 2.0 の場合、 gmcs.rspだけで動きます。


[Unity] How to build unsafe code


Step 1.
 (In the case of Visual Studio) Check "Project > Property > Build > Allow unsafe code"

Step 2.
 Make a file "Assets/smcs.rsp" and "Assets/gmcs.rsp" .
 Inside only '-unsafe' .

Step 3.
 Add 'unsafe' in Unity's "Edit > Project Settings > Player > Other Settings > Configuration > Scripting Define Symbols" .



Reference Sites
http://forum.unity3d.com/threads/how-do-i-enable-unsafe-code.210781/
https://github.com/Banbury/UnityPsdImporter/issues/9