Last active
August 29, 2015 14:00
-
-
Save kankikuchi/3a7792d9c6075c95b775 to your computer and use it in GitHub Desktop.
名前にidle,run,walkを含んだアニメーションを検索、名前をidle,run,walkに変更
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PlayerがAnimationを持っているGameObject | |
//変更するアニメ探し | |
string[] AnimeArrayAfter = { | |
"idle","run","walk", | |
}; | |
ArrayList ChangeAnimeNameList = new ArrayList (); | |
ArrayList ChangeAnimeNameAfterList = new ArrayList (); | |
foreach (AnimationState anim in Player.animation) | |
{ | |
for (int AnimeNo = 0; AnimeNo < AnimeArrayAfter.Length; AnimeNo++) { | |
if (anim.name.IndexOf (AnimeArrayAfter [AnimeNo]) >= 0) { | |
ChangeAnimeNameList.Add (anim.name); | |
ChangeAnimeNameAfterList.Add (AnimeArrayAfter [AnimeNo]); | |
break; | |
} | |
} | |
} | |
//アニメ名変更 | |
for (int ChangeAnimeNo = 0; ChangeAnimeNo < ChangeAnimeNameList.Count; ChangeAnimeNo++) { | |
Player.animation.AddClip ( | |
Player.animation.GetClip(ChangeAnimeNameList[ChangeAnimeNo] as string), | |
ChangeAnimeNameAfterList[ChangeAnimeNo] as string); | |
Player.animation.RemoveClip (ChangeAnimeNameList[ChangeAnimeNo] as string); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment