用脚本创建animator控制器

    依旧博客新手,没有那么老练的文字描述以及层层递进水准,所以暂且所有解释性内容均在代码里进行比较详细的说明,文末附上工程链接。
/*
 * QQ:765459020
 *
 * 用代码生成animator控制器
 *
 * 这里所用资源为Unity自带的2D素材
 * 为了方便,我们取其中的Idle和Run两个animation进行操作
 * 取Idle为默认状态,Run停止时返回Idle状态
 * PS:编辑器并未考虑性能问题
 *
 * 2016-02-15
 *
 */

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
//文件读写
using System.IO;
//Unity基础编辑器
using UnityEditor;
//Unity基础动画编辑
using UnityEditor.Animations;

public class BuildingAnimator : MonoBehaviour
{

    //读取动画地址,为了方便,暂且将创建的animator放在该文件夹内
    private static string ReadExamplePath = Application.dataPath + "/Standard Assets/2D/Animations/";
    //创造animator地址
    private static string CreateExamplePath = "Assets/Standard Assets/2D/Animations/";

    //创建的animator名字,这里一定要注意加后缀".controller"
    private const string ANIMATOR_NAME = "Example_Animator.controller";

    private const string ID
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值