2: 2015-06-18 (木) 23:40:47 iseki | 3: 2015-06-19 (金) 23:09:57 iseki | ||
---|---|---|---|
Line 1: | Line 1: | ||
** うにてぃ [#e1b03924] | ** うにてぃ [#e1b03924] | ||
- | *** Devel [#yfef638b] | + | *** Devel [#p45ef83f] |
- http://caitsithware.com/wordpress/archives/1377 | - http://caitsithware.com/wordpress/archives/1377 | ||
- http://www.slideshare.net/lucifuges/extending-the-unity-editor-extended | - http://www.slideshare.net/lucifuges/extending-the-unity-editor-extended | ||
+ | - http://docs.unity3d.com/jp/current/ScriptReference/ModelImporter.html | ||
+ | - http://baba-s.hatenablog.com/entry/2015/06/09/104109 | ||
#br | #br | ||
+ | Material OnAssignMaterialModel(Material material, Renderer renderer) | ||
+ | { | ||
+ | //テクスチャの名前 | ||
+ | string textureName = material.mainTexture.name; | ||
+ | //作成して保存するマテリアルのパス | ||
+ | AssetDatabase.CreateFolder (Path.GetDirectoryName(assetPath), \\"Materials\\"); | ||
+ | string materialPath = string.Format(\\"{0}/Materials/{1}.mat\\", Path.GetDirectoryName(assetPath),textureName); | ||
+ | |||
+ | Debug.Log(\\"assetPath:\\"+assetPath); | ||
+ | Debug.Log(\\"textureName:\\"+material.mainTexture.name); | ||
+ | Debug.Log(\\"materialPath:\\"+materialPath); | ||
+ | |||
+ | //パスとテクスチャの名前によって、マテリアルを切り替える | ||
+ | //パスにcharacterという文字が含まれていたら | ||
+ | material.shader = Shader.Find(\\"Legacy Shaders/Diffuse\\"); | ||
+ | |||
+ | //シェーダーを変更したマテリアルをmaterialPathに保存する | ||
+ | AssetDatabase.CreateAsset(material, materialPath); | ||
+ | |||
+ | Debug.Log(string.Format(\\"CustomModelImporterの処理により、以下の場所に[{1}]シェーダーのマテリアルを作成しました。\\\\n{0}\\",materialPath,material.shader.name)); | ||
+ | return material; | ||
+ | } |
- Unity3D のバックアップ一覧
- Unity3D のバックアップ差分(No. All)