查看: 2056|回复: 5
打印 上一主题 下一主题

[其他] 官网角色换装资源导入报错解决方案

[复制链接]

2317

主题

54

听众

2万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
20645
精华
62

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2014-8-29 02:27:06 |只看该作者 |倒序浏览
change : UpdateCharacterElementDatabase.cs

class UpdateCharacterElementDatabase
{
// This method collects information about all available
// CharacterElements stores it in the CharacterElementDatabase
// assetbundle. Which CharacterElements are available is
// determined by checking the generated materials.
[MenuItem("Character Generator/Update Character Element Database")]
public static void Execute()
{
List<CharacterElement> characterElements = new List<CharacterElement>();

// As a CharacterElement needs the name of the assetbundle
// that contains its assets, we go through all assetbundles
// to match them to the materials we find.
string[] assetbundles = Directory.GetFiles(CreateAssetbundles.AssetbundlePath);
string[] materials = Directory.GetFiles("Assets/CharacterCustomization/characters", "*.mat", SearchOption.AllDirectories);
foreach (string material in materials)
{
foreach (string bundle in assetbundles)
{
FileInfo bundleFI = new FileInfo(bundle);
FileInfo materialFI = new FileInfo(material);
string bundleName = bundleFI.Name.Replace(".assetbundle", "");
if (!materialFI.Name.StartsWith(bundleName)) continue;
if (!material.Contains("Per Texture Materials")) continue;
characterElements.Add(new CharacterElement(materialFI.Name.Replace(".mat", ""), bundleFI.Name));
break;
}
}

// After collecting all CharacterElements we store them in an
// assetbundle using a ScriptableObject.

// Create a ScriptableObject that contains the list of CharacterElements.
CharacterElementHolder t = ScriptableObject.CreateInstance<CharacterElementHolder> ();
t.content = characterElements;

// Save the ScriptableObject and load the resulting asset so it can
// be added to an assetbundle.
string p = "Assets/assetbundles/CharacterElementDatabase.asset";
AssetDatabase.CreateAsset(t, p);
Object o = AssetDatabase.LoadAssetAtPath(p, typeof(CharacterElementHolder));

// Build the CharacterElementDatabase assetbundle.
BuildPipeline.BuildAssetBundle(o, null, CreateAssetbundles.AssetbundlePath + "CharacterElementDatabase.assetbundle");

// Delete the ScriptableObject.
AssetDatabase.DeleteAsset(p);

Debug.Log("******* Updated Character Element Database, added " + characterElements.Count + " elements *******");
}
}

and in CharacterGenerator.cs


public static string AssetbundleBaseURL
{
get
{
if (Application.platform == RuntimePlatform.WindowsWebPlayer || Application.platform == RuntimePlatform.OSXWebPlayer)
return Application.dataPath+"/assetbundles/";
else
return "file://" + Application.dataPath + "/assetbundles/";
}
}

After that rebuild asset and update element database

分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

hyui    

1

主题

2

听众

6671

积分

高级设计师

Rank: 6Rank: 6

纳金币
2715
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

沙发
发表于 2014-8-29 04:08:34 |只看该作者
Good to know !
回复

使用道具 举报

0

主题

2

听众

4092

积分

中级设计师

Rank: 5Rank: 5

纳金币
530
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

板凳
发表于 2014-8-29 06:59:32 |只看该作者
Thanks for sharing !
回复

使用道具 举报

33

主题

1

听众

2680

积分

中级设计师

Rank: 5Rank: 5

纳金币
559
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

地板
发表于 2014-8-29 09:12:47 |只看该作者
如何将外置动画模型导入Unity
回复

使用道具 举报

ku 智囊团   

89

主题

2

听众

5万

积分

首席设计师

Rank: 8Rank: 8

纳金币
25
精华
1

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

5#
发表于 2014-8-29 09:13:23 |只看该作者
哪年的换装???
回复

使用道具 举报

0

主题

3

听众

2063

积分

中级设计师

Rank: 5Rank: 5

纳金币
21
精华
0
6#
发表于 2017-6-8 11:15:43 |只看该作者

谢谢分享,
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2025-5-26 07:20 , Processed in 0.082549 second(s), 31 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部