はじめに
Inspectorから設定できるものでいいから、とにかくIconをセットしたいと思って調べました。
コード
以下のように書くと実装できます。
public void Create()
{
var obj = new GameObject();
var texture = UnityEditor.EditorGUIUtility.IconContent("sv_label_0").image as Texture2D;
UnityEditor.EditorGUIUtility.SetIconForObject(obj, texture);
}

おわりに
UnityEditor名前空間なのでビルドする際はプリプロセッサで囲んでください。
また、別の色や画像にしたい場合は以下を参考に好みのものを探してみてください。

Where's location of the unity's default icon for scripts
Anyone know about location of the (default) icons of assets.
For example script icon that unity use for all .cs scripts
コメント