2016-11-29 09:47:07 nicepainkiller 阅读数 1774
  • Unity3D入门到精通-(3)Unity资源管理精讲

    本次系列课程的目标是让Unity3D初学者掌握Unity3d的资源管理技术进行了全面介绍,特别对AssetBundle资源如何进行更新,以及加载(依赖资源加载)进行了系统的介绍。 适合对象:Unity初学开发者,Unity中级开发者,网络程序开发者,所有对游戏开发有兴趣的人员。 学习条件:有一定的Unity3D基础,了解C#的基本开发知识。

    4630 人正在学习 去看看 张刚

前几天 要搞软件著作权;需要源代码, 一共60页,每页50行。怎么搞 复制粘贴 60页?

想想作为程序员的我们,不应该干这么 土鳖的事情吧! 后来写了个脚本 导出所有源代码 到文件文件中,

使用之前需要在 桌面创建一个 data.txt 文件

上源码:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;

public class ExportCode : MonoBehaviour {

    public List<string> filePath;
    public List<DirectoryInfo> AllDirector = new List<DirectoryInfo>();

 
    void Start ()
    {
        GetAllDirect(  new DirectoryInfo( Application.dataPath ) );

        GetCSFiles();
        WriteAllDate();
    }


    void WriteAllDate()
    {
        FileStream   aFile = new FileStream(@"C:\Users\join\Desktop\date.txt", FileMode.Create);
        StreamWriter sw = new StreamWriter(aFile);
        string content;
        foreach (string codePath in filePath)
        {
            content =  System.IO.File.ReadAllText(codePath);
            sw.WriteLine(content);
        }
        sw.Close();
    }


    void GetCSFiles()
    {
        foreach (DirectoryInfo info in AllDirector)
        {
            filePath.AddRange(Directory.GetFiles(info.FullName, "*.cs").ToList<string>());
        }
    }


    void GetAllDirect( DirectoryInfo dir)
    {
        DirectoryInfo[] allDirectoryInfo = dir.GetDirectories();

        foreach (DirectoryInfo info in allDirectoryInfo)
        {
            AllDirector.Add(info);
            GetAllDirect(info);
        }

    }

}


2019-11-03 13:12:15 weixin_43659000 阅读数 1069
  • Unity3D入门到精通-(3)Unity资源管理精讲

    本次系列课程的目标是让Unity3D初学者掌握Unity3d的资源管理技术进行了全面介绍,特别对AssetBundle资源如何进行更新,以及加载(依赖资源加载)进行了系统的介绍。 适合对象:Unity初学开发者,Unity中级开发者,网络程序开发者,所有对游戏开发有兴趣的人员。 学习条件:有一定的Unity3D基础,了解C#的基本开发知识。

    4630 人正在学习 去看看 张刚


Unity3D导入AS并利用Fragment显示-本文较为详细介绍了,Unity3D项目导入AS,AS中显示Unity3D,利用Fragment显示Unity3D三个问题的主要过程,一些常见错误都在正文中指出,不再单独列出。

AS显示Unity3D场景

参考文章如下:
在Android(AS)中调用unity场景(view)
主要思路就是在Unity3D利用Gradle导出工程,以Module方式导入AS,再修改为library,完成功能。

Unity3D导出

1.设置Player Settings

主要设置内容为:Company Name、Product Name及Other Settings中的Package Name,至于参考文章中提到的Keystore我未做处理以及包名和AS中包名是否相同具体什么情况我不太了解,我在实践中是不相同的,目前并没有遇到问题。
主要截图如下:
Player Settings
Other Settings
Publishing Settings

2.导出项目

选中Gradle导出即可
导出设置如下:
导出
导出后得到文件目录:
文件目录

AS导入Unity3D项目

1.以Module形式导入Unity3D项目

导入

2.修改Module为library

1.导入时在AS中两个项目独立,图标显示这样:
导入
2.在build.gradle中将application修改为library
修改build.gradle
3.提示Sync,点击后报错,直接在build.gradle中删掉bundle()
报错
4.Try Again后,再次报错,这是因为设置了两个applicationId,将Unity3D中的删除即可
报错
删除applicationId
5.再次Try Again,成功,图标改变
图标改变

3.添加依赖

这个有多种方法,我是用AS设置。
1.打开Project Structure
Project Structure
2.在app依赖中添加Module依赖
添加依赖
选中
3.ok后报错(这是因为我的Unity3D项目中使用了别的库,各位自行了解),找不到这个库,我直接在app中添加这个依赖,VuforiaWrapper为aar文件,我将其复制到app的libs再依赖。
报错
复制

加依赖
4.Sync后报错,此时需要将libs加入路径,Try Again后成功
报错
加入路径

repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }
    }

4.为了避免冲突及统一修改AndroidManifest

虽说会自动合并,但是我将所有统一写在app的AndroidManifest中
1.将Unity3D项目AndroidManifest中所有合并到app的AndroidManifest中(这里请自行设置常规设置),需要注意的是参考文章中提到的关于启动页的问题。
Unity3DAndroidManifest修改完后
注意需要删除图中选中代码(设置启动页)
删除

5.尝试组建

组建成功,说明导入完成
组建成功

在AS中测试是否能够打开Unity3D场景

通过刚刚导出的Module可以发现Unity3D项目只是提供一个Activity,当你进入这个Activity即可显示Unity3D中的场景,至于加载Unity3D中的那个View是由Unity3D项目自己控制的,当然可以通过AS和Unity3D交互完成切换,这里不讨论。

1.在app的MainActivity中添加一个按钮跳转到Unity3D场景

1.添加按钮,按钮添加过程略去
2.利用intent跳转,发现在打入UnityPlayerActivity过程中会有提示,这是因为我们在app中注册了Unity3D项目中提供的那个Activity
跳转
默认Activity

2.在虚拟机上运行测试

1.点击前
点击前
2.点击后
请求允许
进入虚拟相机场景
3.成功完成

在Fragment中显示Unity3D场景

之前提到Unity3D项目只提供了一个Activity,在Activity中发现具体是利用UnityPlayer完成。经过网上搜索后,成功实现在Fragment中显示Unity3D场景。参考文章如下:
android的fragment中嵌套unity3d+事件控制 附带实例
android与Unity3D交互,fragment显示unity3d视图

创建Fragment

1.创建一个AFragment继承Fragment(注意为v4支持),并添加onAttach、onCreateView、onPause、onResume方法

这几个方法在控制UnityPlayer时需要用到。过程略。

2.在app的MainActivity中创建Fragment容器,并加入AFragment

1.添加容器为了便于观察控制高度为300dp
容器
2.在MainActivity中实例化AFragment并添加至容器
实例化并添加

aFragment = new AFragment();
getSupportFragmentManager().beginTransaction().add(R.id.fl_container_a,aFragment).commitAllowingStateLoss();

若报错
报错
说明没有继承v4的Fragment

3.虚拟机运行测试

虚拟机测试
由于AFragment什么也没有添加,所以显示为空白,但运行成功说明问题不大

在Fragment中添加UnityPlayer

1.在app中添加unity-classes依赖

因为在app需要用到UnityPlayer,故需要添加依赖
1.将jar包复制到app的libs中,添加依赖
加依赖
2.添加后Gradle为报错,但重新组建时,报错,这是因为app依赖的Unity3D项目library中同样依赖了unity-classes,故修改Unity3D中依赖方式为编译时依赖(我就这么一说)即可
报错
修改依赖方式,注意去掉之前那个依赖jar包语句
依赖

//implementation fileTree(dir: 'libs', include: ['*.jar'])
  compileOnly files('libs/unity-classes.jar')

3.Sync后成功,重新组建后成功。

2.在MainActivity中初始化UnityPlayer

这里使用参考文章中的那个方法,使用静态变量mUnityPlayer完成
1.创建一个新类继承Activity以储存静态变量mUnityPlayer
因为Android会自动回收,推荐使用这种方式管理静态变量
Constants类
2.在MainActivity中初始化mUnityPlayer
初始化

Constants.mUnityPlayer = new UnityPlayer(this);
int glesMode = Constants.mUnityPlayer.getSettings().getInt("gles_mode", 1);
Constants.mUnityPlayer.init(glesMode, false);

2.在MainActivity中关联mUnityPlayer的onResume、onPause、onDestroy、onConfigurationChanged、onWindowFocusChanged、dispatchKeyEvent(这些都可以在Unity3D项目中提供的UnityPlayerActivity中找到)
关联
关联

    @Override
    protected void onDestroy() {
        Constants.mUnityPlayer.quit();
        super.onDestroy();
    }

    @Override
    protected void onResume() {
        Constants.mUnityPlayer.resume();
        super.onResume();
    }

    @Override
    protected void onPause() {
        Constants.mUnityPlayer.pause();
        super.onPause();
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        Constants.mUnityPlayer.configurationChanged(newConfig);
        super.onConfigurationChanged(newConfig);
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        Constants.mUnityPlayer.windowFocusChanged(hasFocus);
        super.onWindowFocusChanged(hasFocus);
    }

    @Override
    public boolean dispatchKeyEvent(KeyEvent event) {
        if (event.getAction() == KeyEvent.ACTION_MULTIPLE)
            return Constants.mUnityPlayer.onKeyMultiple(event.getKeyCode(), event.getRepeatCount(), event);
        return super.dispatchKeyEvent(event);
    }

3.AFragment中返回mUnityPlayer的View,并关联

1.在onCreateView中返回playerView,注意这里windowFocusChanged的关联(黑屏问题)
onCreateView
2.关联onResume、onPause
关联

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mcontext = (Activity) context;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        playerView = Constants.mUnityPlayer.getView();
        if(playerView.getParent() != null){
            ((ViewGroup)playerView.getParent()).removeAllViews();
        }
        playerView.getViewTreeObserver().addOnWindowFocusChangeListener(new ViewTreeObserver.OnWindowFocusChangeListener() {
            @Override
            public void onWindowFocusChanged(boolean hasFocus) {
                Constants.mUnityPlayer.windowFocusChanged(hasFocus);
            }
        });
        return playerView;
    }

    @Override
    public void onResume() {
        Constants.mUnityPlayer.resume();
        super.onResume();
    }

    @Override
    public void onPause() {
        Constants.mUnityPlayer.pause();
        super.onPause();
    }

4.大功告成虚拟机测试

1.点击按钮前
点击前
2.点击按钮后退出,原因好像是因为只能有一个UnityPalyer,这不是什么大问题了,mUnitypalyer已经是静态变量了
点击后

可能遇到的问题

1.运行时报错:No implementation found for void com.unity3d.player.UnityPlayer.nativeRestartActivityIndicator()

具体为什么并不清楚,大体上是因为build.gradle设置的问题(大概是32和64的问题),可以尝试在app的build.gradle中加上下面代码

sourceSets {
        main {
            jniLibs.srcDirs = ['libs']
        }
    }
    defaultConfig {
        ndk {
            abiFilters 'armeabi-v7a', 'x86'
        }
    }
2013-04-24 13:59:09 kakukemeit 阅读数 2353
  • Unity3D入门到精通-(3)Unity资源管理精讲

    本次系列课程的目标是让Unity3D初学者掌握Unity3d的资源管理技术进行了全面介绍,特别对AssetBundle资源如何进行更新,以及加载(依赖资源加载)进行了系统的介绍。 适合对象:Unity初学开发者,Unity中级开发者,网络程序开发者,所有对游戏开发有兴趣的人员。 学习条件:有一定的Unity3D基础,了解C#的基本开发知识。

    4630 人正在学习 去看看 张刚
由于115网盘近日限制了大众下载,为了方便大家下载,我们将本书的所有源代码转移至新浪微盘,下载的时候需要登录新浪微博。具体下载地址如下:
 
Mac版本 
Unity3D游戏开发第2章源码:http://vdisk.weibo.com/s/aawwn 
Unity3D游戏开发第3章源码:http://vdisk.weibo.com/s/aaFIE 
Unity3D游戏开发第4章源码:http://vdisk.weibo.com/s/aax_x 
Unity3D游戏开发第5章源码:http://vdisk.weibo.com/s/ab0hz 
Unity3D游戏开发第6章源码:http://vdisk.weibo.com/s/ab9bl 
Unity3D游戏开发第7章源码:http://vdisk.weibo.com/s/ab6Qo 
Unity3D游戏开发第8章源码:http://vdisk.weibo.com/s/aaVmE 
Unity3D游戏开发第9章源码:http://vdisk.weibo.com/s/ab7__ 
Unity3D游戏开发第10章源码: http://vdisk.weibo.com/s/ab3Y- 


Windows版本 
Unity3D游戏开发第2章源码:http://vdisk.weibo.com/s/aay1Q 
Unity3D游戏开发第3章源码:http://vdisk.weibo.com/s/ab8C9 
Unity3D游戏开发第4章源码:http://vdisk.weibo.com/s/aayYe 
Unity3D游戏开发第5章源码:http://vdisk.weibo.com/s/abcDK 
Unity3D游戏开发第6章源码:http://vdisk.weibo.com/s/abHQU 
Unity3D游戏开发第7章源码:http://vdisk.weibo.com/s/ablwD 
Unity3D游戏开发第8章源码:http://vdisk.weibo.com/s/abDw3 
Unity3D游戏开发第9章源码:http://vdisk.weibo.com/s/abQ16 
Unity3D游戏开发第10章源码: http://vdisk.weibo.com/s/ac5-I
2017-10-25 09:58:42 nicepainkiller 阅读数 1038
  • Unity3D入门到精通-(3)Unity资源管理精讲

    本次系列课程的目标是让Unity3D初学者掌握Unity3d的资源管理技术进行了全面介绍,特别对AssetBundle资源如何进行更新,以及加载(依赖资源加载)进行了系统的介绍。 适合对象:Unity初学开发者,Unity中级开发者,网络程序开发者,所有对游戏开发有兴趣的人员。 学习条件:有一定的Unity3D基础,了解C#的基本开发知识。

    4630 人正在学习 去看看 张刚

其中stateText 为Text 当然也可以是 Image 等等UGUI的 组件

onTextClick 为方法的回调



            EventTrigger trigger        = stateText.gameObject.GetComponentEx<EventTrigger>();
            trigger.triggers            = new System.Collections.Generic.List<EventTrigger.Entry>();

            EventTrigger.Entry entry    = new EventTrigger.Entry();
            entry.eventID               = EventTriggerType.PointerClick;
            entry.callback              = new EventTrigger.TriggerEvent();

            entry.callback.AddListener(OnTextClick);
            trigger.triggers.Add(entry);


2019-12-10 20:29:44 lbh19630726 阅读数 81
  • Unity3D入门到精通-(3)Unity资源管理精讲

    本次系列课程的目标是让Unity3D初学者掌握Unity3d的资源管理技术进行了全面介绍,特别对AssetBundle资源如何进行更新,以及加载(依赖资源加载)进行了系统的介绍。 适合对象:Unity初学开发者,Unity中级开发者,网络程序开发者,所有对游戏开发有兴趣的人员。 学习条件:有一定的Unity3D基础,了解C#的基本开发知识。

    4630 人正在学习 去看看 张刚

①重新创建一个工程文件夹,引入带有资源文件的游戏项目。

在unity的工作区间,重新创建一个endlessrunner06文件夹。

 双击unity3d软件:

等待进度条完成

等待进度条完成

等待进度条完成

②将之前步骤利用assetbundle已经打包成.unity3d的文件夹和文件进行删除,后期利用云服务器下载即可。

 

③将一些重名的组件更改一下名字,后期好找到这些组件。

 

更改完以后记得save scene和save project。

④核心代码:从远程服务器找到用assetbundle打包的.unity3d文件。

在GamePlay文件夹创建c#文件myassets

右键

再按F2键,将c#文件名,改为:myassets

c#文件myassets的内容为:

using UnityEngine;
using System.Collections.Generic;
using System.Collections;

public class myassets : MonoBehaviour
{
	void Start()
	{
		this.StartCoroutine(LoadAssetBundle());
	}
	
	IEnumerator LoadAssetBundle()
	{
		//string url = "http://127.0.0.1:9101/endlessrunnerassets/myassets15android.unity3d";
		string url = "http://XX:XXX:XX:XXX:XX/endlessrunner02/endlessrunnerassets/myassets17android.unity3d";
		//开始加载WWW
		WWW www = WWW.LoadFromCacheOrDownload (url, 4);
		Debug.Log ("**************");
		//yield return www;
		Debug.Log ("**********02");
		//加载失败
		if(www.error != null)
		{
			Debug.Log("Load Bundle Faile " + url + " Error Is " + www.error);
			yield break;
		}
		
		AssetBundle bundle = www.assetBundle;
		Object[] objs = bundle.LoadAll();
		//Debug.Log(objs.Length);
		for(int i =0;i< objs.Length;i++){
			/*
			if(objs[i].name.Equals("ColliderSpawn")){
				Debug.Log("ColliderSpawn的index="+i);
			}

			if(objs[i].name.Equals("SpawnObj")){
				Debug.Log("SpawnObj的index="+i);
			}


			if(objs[i].name.Equals("coin")){
				Debug.Log("coin的index="+i);
			}

			if(objs[i].name.Equals("slide")){
				Debug.Log("slide的index="+i);
			}

			if(objs[i].name.Equals("hit")){
				Debug.Log("hit的index="+i);
			}

			if(objs[i].name.Equals("getitem")){
				Debug.Log("getitem的index="+i);
			}
*/
			if(objs[i].name.Equals("bgm - Bounce_It")){
				Debug.Log("bgm - Bounce_It的index="+i);
			}
			/*
			if(objs[i].name.Equals("Run")){
				Debug.Log("Run的index="+i);
			}

			if(objs[i].name.Equals("TurnLeft")){
				Debug.Log("TurnLeft的index="+i);
			}

			if(objs[i].name.Equals("TurnRight")){
				Debug.Log("TurnRight的index="+i);
			}

			if(objs[i].name.Equals("JumpUp")){
				Debug.Log("JumpUp的index="+i);
			}

			if(objs[i].name.Equals("JumpDown")){
				Debug.Log("JumpDown的index="+i);
			}

			if(objs[i].name.Equals("JumpLoop")){
				Debug.Log("JumpLoop的index="+i);
			}

			if(objs[i].name.Equals("Roll")){
				Debug.Log("Roll的index="+i);
			}

			if(objs[i].name.Equals("Dead")){
				Debug.Log("Dead的index="+i);
			}
*/
			
			//Debug.Log(objs[i].name);
		}
		
		DestroyImmediate (GameObject.Find ("SettingMaterial").GetComponent<SettingMaterial> (), true);
		GameObject.Find("SettingMaterial").AddComponent<SettingMaterial>();
		Material material0 = bundle.Load("Board" ,typeof (Material)) as Material;
		//Instantiate(material0);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[0]=material0;
		
		Material material1 = bundle.Load("Car_Texture" ,typeof (Material)) as Material;
		//Instantiate(material1);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[1]=material1;
		
		Material material2 = bundle.Load("CoinTexture" ,typeof (Material)) as Material;
		//Instantiate(material2);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[2]=material2;
		
		
		Material material3 = bundle.Load("Gave" ,typeof (Material)) as Material;
		//Instantiate(material3);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[3]=material3;
		
		Material material4 = bundle.Load("Road" ,typeof (Material)) as Material;
		Instantiate(material4);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[4]=material4;
		
		Material material5 = bundle.Load("Store" ,typeof (Material)) as Material;
		//Instantiate(material5);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[5]=material5;
		
		Material material6 = bundle.Load("TheCube_Jump" ,typeof (Material)) as Material;
		//Instantiate(material6);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[6]=material6;
		
		Material material7 = bundle.Load("TheCube_Magnet" ,typeof (Material)) as Material;
		//Instantiate(material7);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[7]=material7;
		
		Material material8 = bundle.Load("TheCube_Multiply" ,typeof (Material)) as Material;
		//Instantiate(material8);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[8]=material8;
		
		Material material9 = bundle.Load("TheCube_Run" ,typeof (Material)) as Material;
		//Instantiate(material9);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[9]=material9;
		
		Material material10 = bundle.Load("Tx_modelB001" ,typeof (Material)) as Material;
		//Instantiate(material10);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[10]=material10;
		
		Material material11 = bundle.Load("Tx_modelB001-2" ,typeof (Material)) as Material;
		//Instantiate(material11);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[11]=material11;
		
		Material material12 = bundle.Load("Tx_modelB001-3" ,typeof (Material)) as Material;
		//Instantiate(material12);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[12]=material12;
		
		Material material13 = bundle.Load("Tx_modelB001-4" ,typeof (Material)) as Material;
		//Instantiate(material13);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[13]=material13;
		
		Material material14 = bundle.Load("Tx_modelB001-5" ,typeof (Material)) as Material;
		//Instantiate(material14);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[14]=material14;
		
		Material material15 = bundle.Load("Tx_modelB001-6" ,typeof (Material)) as Material;
		//Instantiate(material15);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[15]=material15;
		
		Material material16 = bundle.Load("Tx_tunnel_1" ,typeof (Material)) as Material;
		//Instantiate(material16);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[16]=material16;
		
		Material material17 = bundle.Load("Tx_tunnel_2" ,typeof (Material)) as Material;
		//Instantiate(material17);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[17]=material17;
		
		Material material18 = bundle.Load("Tx_tunnel_Long" ,typeof (Material)) as Material;
		//Instantiate(material18);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[18]=material18;
		
		Material material19 = bundle.Load("Tx_BoardUp" ,typeof (Material)) as Material;
		//Instantiate(material19);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[19]=material19;
		
		Material material20 = bundle.Load("Tx_Buss" ,typeof (Material)) as Material;
		//Instantiate(material20);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[20]=material20;
		
		Material material21 = bundle.Load("Tx_Bridge" ,typeof (Material)) as Material;
		//Instantiate(material21);
		GameObject.Find("SettingMaterial").GetComponent<SettingMaterial>().materials[21]=material21;
		
		
		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		GameObject floorPref = bundle.Load("Floor" ,typeof (GameObject)) as GameObject;
		//Instantiate(floorPref);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().floor_Pref = floorPref;
		
		
		GameObject model01 = bundle.Load ("modelB1-1",typeof(GameObject)) as GameObject;
		//Instantiate (model01);
		//Debug.Log (model01.name);
		//GameObject modelB01 = model01.transform.Find("modelB001").gameObject;
		//model01.transform.Find ("modelB001").gameObject;
		//Instantiate (modelB01);
		//Debug.Log (modelB01.name);
		
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		GameObject gameObject0 = bundle.Load  ("Building_1" ,typeof (GameObject)) as GameObject;
		Debug.Log ("============"+gameObject0.name);
		//Instantiate(gameObject0);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[0]=gameObject0;
		DestroyImmediate(gameObject0.GetComponent<Building>(),true);
		gameObject0.AddComponent<Building>();
		
		
		
		
		GameObject gameObject1 = bundle.Load("Building_2" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject1);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[1]=gameObject1;
		DestroyImmediate(gameObject1.GetComponent<Building>(),true);
		gameObject1.AddComponent<Building>();
		
		
		GameObject gameObject2 = bundle.Load("Building_3" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject2);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[2]=gameObject2;
		DestroyImmediate(gameObject2.GetComponent<Building>(),true);
		gameObject2.AddComponent<Building>();
		
		
		GameObject gameObject3 = bundle.Load("Building_4" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject3);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[3]=gameObject3;
		DestroyImmediate(gameObject3.GetComponent<Building>(),true);
		gameObject3.AddComponent<Building>();
		
		
		GameObject gameObject4 = bundle.Load("Building_5" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject4);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[4]=gameObject4;
		DestroyImmediate(gameObject4.GetComponent<Building>(),true);
		gameObject4.AddComponent<Building>();
		
		
		GameObject gameObject5 = bundle.Load("Building_6" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject5);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[5]=gameObject5;
		DestroyImmediate(gameObject5.GetComponent<Building>(),true);
		gameObject5.AddComponent<Building>();
		
		
		GameObject gameObject6 = bundle.Load("Building_7" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject6);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[6]=gameObject6;
		DestroyImmediate(gameObject6.GetComponent<Building>(),true);
		gameObject6.AddComponent<Building>();
		
		
		GameObject gameObject7 = bundle.Load("Building_8" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject7);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[7]=gameObject7;
		DestroyImmediate(gameObject7.GetComponent<Building>(),true);
		gameObject7.AddComponent<Building>();
		
		
		GameObject gameObject8 = bundle.Load("Building_9" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject8);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[8]=gameObject8;
		DestroyImmediate(gameObject8.GetComponent<Building>(),true);
		gameObject8.AddComponent<Building>();
		
		
		GameObject gameObject9 = bundle.Load("Building_10" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject9);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[9]=gameObject9;
		DestroyImmediate(gameObject9.GetComponent<Building>(),true);
		gameObject9.AddComponent<Building>();
		
		
		GameObject gameObject10 = bundle.Load("Building_11" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject10);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[10]=gameObject10;
		DestroyImmediate(gameObject10.GetComponent<Building>(),true);
		gameObject10.AddComponent<Building>();
		
		
		GameObject gameObject11 = bundle.Load("Building_12" ,typeof (GameObject)) as GameObject;
		//Instantiate(gameObject11);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().building_Pref[11]=gameObject11;
		DestroyImmediate(gameObject11.GetComponent<Building>(),true);
		gameObject11.AddComponent<Building>();
		
		
		///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		GameObject itemPref0 = bundle.Load("Barrier" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref0);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[0]=itemPref0;
		DestroyImmediate(itemPref0.GetComponent<Item>(),true);
		itemPref0.AddComponent<Item>();
		itemPref0.GetComponent<Item> ().scoreAdd = 0;
		itemPref0.GetComponent<Item> ().decreaseLife = 1;
		itemPref0.GetComponent<Item> ().speedMove = 0;
		itemPref0.GetComponent<Item> ().duration = 0;
		itemPref0.GetComponent<Item> ().itemEffectValue = 0;  
		itemPref0.GetComponent<Item> ().typeItem = Item.TypeItem.Obstacle;
		
		
		
		
		GameObject itemPref1 = bundle.Load("Car" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref1);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[1]=itemPref1;
		DestroyImmediate(itemPref1.GetComponent<Item>(),true);
		itemPref1.AddComponent<Item>();
		itemPref1.GetComponent<Item> ().scoreAdd = 0;
		itemPref1.GetComponent<Item> ().decreaseLife = 1;
		itemPref1.GetComponent<Item> ().speedMove = 0;
		itemPref1.GetComponent<Item> ().duration = 0;
		itemPref1.GetComponent<Item> ().itemEffectValue = 0;
		itemPref1.GetComponent<Item> ().typeItem = Item.TypeItem.Obstacle;
		
		
		
		
		
		
		GameObject  itemPref2 = bundle.Load("Coin02" ,typeof (GameObject)) as GameObject;
		//Instantiate (itemPref2);
		GameObject Cylinder = itemPref2.transform.Find ("Cylinder").gameObject;
		DestroyImmediate (Cylinder.GetComponent<ItemRotate>(),true);
		Cylinder .AddComponent<ItemRotate> ();
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[2]=itemPref2;		
		DestroyImmediate(itemPref2.GetComponent<Item>(),true);
		itemPref2.AddComponent<Item>();
		itemPref2.GetComponent<Item> ().scoreAdd = 1;
		itemPref2.GetComponent<Item> ().decreaseLife = 0;
		itemPref2.GetComponent<Item> ().speedMove = 0;
		itemPref2.GetComponent<Item> ().duration = 0;
		itemPref2.GetComponent<Item> ().itemEffectValue = 0;
		itemPref2.GetComponent<Item> ().itemRotate = Cylinder.GetComponent<ItemRotate>();
		GameObject coinCollectFlash = bundle.Load ("CoinCollectFlash",typeof (GameObject)) as GameObject;
		DestroyImmediate(coinCollectFlash.GetComponent<DestroyEffect>(),true);
		coinCollectFlash.AddComponent<DestroyEffect>();
		coinCollectFlash.GetComponent<DestroyEffect> ().time = 0.7f;
		itemPref2.GetComponent<Item> ().effectHit = coinCollectFlash;
		itemPref2.GetComponent<Item> ().typeItem = Item.TypeItem.Coin;
		
		
		
		
		
		GameObject itemPref3 = bundle.Load("Grave" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref3);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[3]=itemPref3;
		DestroyImmediate(itemPref3.GetComponent<Item>(),true);
		itemPref3.AddComponent<Item>();
		itemPref3.GetComponent<Item> ().decreaseLife = 1;
		itemPref3.GetComponent<Item> ().typeItem = Item.TypeItem.Obstacle;
		
		
		
		GameObject itemPref4 = bundle.Load("Item_Jump" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref4);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[4]=itemPref4;
		DestroyImmediate(itemPref4.GetComponent<Item>(),true);
		itemPref4.AddComponent<Item>();
		itemPref4.GetComponent<Item> ().scoreAdd = 2;
		itemPref2.GetComponent<Item> ().decreaseLife = 1;
		itemPref2.GetComponent<Item> ().speedMove = 0;
		itemPref2.GetComponent<Item> ().duration = 15;
		itemPref2.GetComponent<Item> ().itemEffectValue = 0;
		GameObject theCube_Shoe = bundle.Load ("TheCube_Shoe",typeof(GameObject)) as GameObject;
		DestroyImmediate(theCube_Shoe.GetComponent<DestroyEffect>(),true);
		theCube_Shoe.AddComponent<DestroyEffect>();
		theCube_Shoe.GetComponent<DestroyEffect> ().time = 0.8f;
		itemPref4.GetComponent<Item> ().effectHit = theCube_Shoe;
		itemPref4.GetComponent<Item> ().typeItem = Item.TypeItem.ItemJump;
		
		
		
		
		
		
		GameObject itemPref5 = bundle.Load("Item_Magnet" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref5);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[5]=itemPref5;
		DestroyImmediate (itemPref5.GetComponent<Item>(),true);
		itemPref5.AddComponent<Item>();
		itemPref5.GetComponent<Item> ().scoreAdd = 0;
		itemPref5.GetComponent<Item> ().decreaseLife = 1;
		itemPref5.GetComponent<Item> ().speedMove = 0;
		itemPref5.GetComponent<Item> ().duration = 10;
		itemPref5.GetComponent<Item> ().itemEffectValue = 0;
		GameObject theCube_Magnet = bundle.Load ("TheCube_Magnet",typeof(GameObject)) as GameObject;
		DestroyImmediate(theCube_Magnet.GetComponent<DestroyEffect>(),true);
		theCube_Magnet.AddComponent<DestroyEffect>();
		theCube_Magnet.GetComponent<DestroyEffect> ().time = 0.8f;
		itemPref5.GetComponent<Item> ().effectHit = theCube_Magnet;
		itemPref5.GetComponent<Item> ().typeItem = Item.TypeItem.ItemMagnet;
		
		
		
		
		
		GameObject itemPref6 = bundle.Load("Item_Sprint" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref6);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[6]=itemPref6;
		DestroyImmediate (itemPref6.GetComponent<Item>(),true);
		itemPref6.AddComponent<Item>();
		itemPref6.GetComponent<Item> ().scoreAdd = 0;
		itemPref6.GetComponent<Item> ().decreaseLife = 1;
		itemPref6.GetComponent<Item> ().speedMove = 0;
		itemPref6.GetComponent<Item> ().duration = 5;
		itemPref6.GetComponent<Item> ().itemEffectValue = 20;
		GameObject theCube_Star = bundle.Load ("TheCube_Star",typeof(GameObject)) as GameObject;
		DestroyImmediate(theCube_Star.GetComponent<DestroyEffect>(),true);
		theCube_Star.AddComponent<DestroyEffect>();
		theCube_Star.GetComponent<DestroyEffect> ().time = 0.8f;
		itemPref6.GetComponent<Item> ().effectHit = theCube_Star;
		itemPref6.GetComponent<Item> ().typeItem=Item.TypeItem.ItemSprint;
		
		
		
		
		
		GameObject itemPref7 = bundle.Load("Obstacle_Roll" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref7);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[7]=itemPref7;
		DestroyImmediate (itemPref7.GetComponent<Item>(),true);
		itemPref7.AddComponent<Item>();
		itemPref7.GetComponent<Item> ().scoreAdd = 0;
		itemPref7.GetComponent<Item> ().decreaseLife = 1;
		itemPref7.GetComponent<Item> ().speedMove = 0;
		itemPref7.GetComponent<Item> ().duration = 0;
		itemPref7.GetComponent<Item> ().itemEffectValue = 0;
		itemPref7.GetComponent<Item> ().typeItem=Item.TypeItem.Obstacle_Roll;
		
		
		
		
		
		
		
		
		
		
		GameObject itemPref8 = bundle.Load("Item_Multiply" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref8);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[8]=itemPref8;
		DestroyImmediate (itemPref8.GetComponent<Item>(),true);
		itemPref8.AddComponent<Item>();
		itemPref8.GetComponent<Item> ().scoreAdd = 0;
		itemPref8.GetComponent<Item> ().decreaseLife = 1;
		itemPref8.GetComponent<Item> ().speedMove = 0;
		itemPref8.GetComponent<Item> ().duration = 15;
		itemPref8.GetComponent<Item> ().itemEffectValue = 2;
		GameObject theCube_Double = bundle.Load ("TheCube_Double",typeof(GameObject)) as GameObject;
		DestroyImmediate(theCube_Double.GetComponent<DestroyEffect>(),true);
		theCube_Double.AddComponent<DestroyEffect>();
		theCube_Double.GetComponent<DestroyEffect> ().time = 0.8f;
		itemPref8.GetComponent<Item> ().effectHit = theCube_Double;
		itemPref8.GetComponent<Item>().typeItem=Item.TypeItem.ItemMultiply;
		
		
		
		
		
		
		
		GameObject itemPref9 = bundle.Load("Bus" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref9);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[9]=itemPref9;
		DestroyImmediate (itemPref9.GetComponent<Item>(),true);
		itemPref9.AddComponent<Item>();
		itemPref9.GetComponent<Item> ().scoreAdd = 0;
		itemPref9.GetComponent<Item> ().decreaseLife = 1;
		itemPref9.GetComponent<Item> ().speedMove = 0;
		itemPref9.GetComponent<Item> ().duration = 0;
		itemPref9.GetComponent<Item> ().itemEffectValue = 0;
		itemPref8.GetComponent<Item>().typeItem=Item.TypeItem.Obstacle;
		
		
		
		
		
		
		
		
		GameObject itemPref10 = bundle.Load("BoardUp_Short" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref10);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[10]=itemPref10;
		DestroyImmediate (itemPref10.GetComponent<Item>(),true);
		itemPref10.AddComponent<Item>();
		itemPref10.GetComponent<Item> ().scoreAdd = 0;
		itemPref10.GetComponent<Item> ().decreaseLife = 1;
		itemPref10.GetComponent<Item> ().speedMove = 0;
		itemPref10.GetComponent<Item> ().duration = 0;
		itemPref10.GetComponent<Item> ().itemEffectValue = 0;
		
		
		
		
		
		GameObject itemPref11 = bundle.Load("BoardUp_Long" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref11);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[11]=itemPref11;
		DestroyImmediate (itemPref11.GetComponent<Item>(),true);
		itemPref11.AddComponent<Item>();
		itemPref11.GetComponent<Item> ().scoreAdd = 0;
		itemPref11.GetComponent<Item> ().decreaseLife = 1;
		itemPref11.GetComponent<Item> ().speedMove = 0;
		itemPref11.GetComponent<Item> ().duration = 0;
		itemPref11.GetComponent<Item> ().itemEffectValue = 0;
		
		
		
		
		
		
		
		
		GameObject itemPref12 = bundle.Load("ItemTest" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref12);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[12]=itemPref12;
		DestroyImmediate (itemPref12.GetComponent<Item>(),true);
		itemPref12.AddComponent<Item>();
		itemPref12.GetComponent<Item> ().scoreAdd = 0;
		itemPref12.GetComponent<Item> ().decreaseLife = 0;
		itemPref12.GetComponent<Item> ().speedMove = 0;
		itemPref12.GetComponent<Item> ().duration = 0;
		itemPref12.GetComponent<Item> ().itemEffectValue = 0;
		
		
		
		
		
		
		
		
		
		
		GameObject itemPref13 = bundle.Load("ItemTest_2" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref13);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[13]=itemPref13;
		DestroyImmediate (itemPref13.GetComponent<Item>(),true);
		itemPref13.AddComponent<Item>();
		itemPref13.GetComponent<Item> ().scoreAdd = 0;
		itemPref13.GetComponent<Item> ().decreaseLife = 0;
		itemPref13.GetComponent<Item> ().speedMove = 0;
		itemPref13.GetComponent<Item> ().duration = 0;
		itemPref13.GetComponent<Item> ().itemEffectValue = 0;
		
		
		
		
		
		
		
		
		
		
		
		GameObject itemPref14 = bundle.Load("Tunnel_Long" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref14);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[14]=itemPref14;
		DestroyImmediate (itemPref14.GetComponent<Item>(),true);
		itemPref14.AddComponent<Item>();
		itemPref14.GetComponent<Item> ().scoreAdd = 0;
		itemPref14.GetComponent<Item> ().decreaseLife = 1;
		itemPref14.GetComponent<Item> ().speedMove = 0;
		itemPref14.GetComponent<Item> ().duration = 0;
		itemPref14.GetComponent<Item> ().itemEffectValue = 0;
		
		
		
		
		
		
		
		
		
		
		GameObject itemPref15 = bundle.Load("Tunnel_L" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref15);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[15]=itemPref15;
		DestroyImmediate (itemPref15.GetComponent<Item>(),true);
		itemPref15.AddComponent<Item>();
		itemPref15.GetComponent<Item> ().scoreAdd = 0;
		itemPref15.GetComponent<Item> ().decreaseLife = 1;
		itemPref15.GetComponent<Item> ().speedMove = 0;
		itemPref15.GetComponent<Item> ().duration = 0;
		itemPref15.GetComponent<Item> ().itemEffectValue = 0;
		itemPref15.GetComponent<Item> ().typeItem = Item.TypeItem.Obstacle;
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		GameObject itemPref16 = bundle.Load("Bridge" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref16);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[16]=itemPref16;
		DestroyImmediate (itemPref16.GetComponent<Item>(),true);
		itemPref16.AddComponent<Item>();
		itemPref16.GetComponent<Item> ().scoreAdd = 0;
		itemPref16.GetComponent<Item> ().decreaseLife = 0;
		itemPref16.GetComponent<Item> ().speedMove = 0;
		itemPref16.GetComponent<Item> ().duration = 0;
		itemPref16.GetComponent<Item> ().itemEffectValue = 0;
		
		
		
		
		
		
		
		GameObject itemPref17 = bundle.Load("Bus_Moving" ,typeof (GameObject)) as GameObject;
		//Instantiate(itemPref17);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[17]=itemPref17;
		DestroyImmediate (itemPref17.GetComponent<Item>(),true);
		itemPref17.AddComponent<Item>();
		itemPref17.GetComponent<Item> ().scoreAdd = 0;
		itemPref17.GetComponent<Item> ().decreaseLife = 1;
		itemPref17.GetComponent<Item> ().speedMove = 8;
		itemPref17.GetComponent<Item> ().duration = 0;
		itemPref17.GetComponent<Item> ().itemEffectValue = 0;
		itemPref17.GetComponent<Item> ().typeItem = Item.TypeItem.Moving_Obstacle;
		
		//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		GameObject spawnobjPref = bundle.Load("SpawnObj" ,typeof (GameObject)) as GameObject;
		//Instantiate(spawnobjPref);
		GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().spawnObj_Pref = spawnobjPref;
		
		
		
		
		
		
		
		
		//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		GameObject player01 = bundle.Load("Player" ,typeof (GameObject)) as GameObject;
		GameObject.Find("GameController").GetComponent<GameController>().playerPref[0] = player01;
		DestroyImmediate(player01.GetComponent<Controller>(),true);
		DestroyImmediate(player01.GetComponent<AnimationManager>(),true);
		player01.AddComponent<AnimationManager>();
		player01.GetComponent<AnimationManager > ().run.animation=(AnimationClip)objs[310];
		player01.GetComponent<AnimationManager> ().run.speedAnimation = 1.5f;
		player01.GetComponent<AnimationManager> ().turnLeft.animation = (AnimationClip)objs[311];
		player01.GetComponent<AnimationManager> ().turnLeft.speedAnimation = 1.25f;
		player01.GetComponent<AnimationManager> ().turnRight.animation = (AnimationClip)objs[312];
		player01.GetComponent<AnimationManager> ().turnRight.speedAnimation = 1.25f;
		player01.GetComponent<AnimationManager> ().jumpUp.animation = (AnimationClip)objs[308];
		player01.GetComponent<AnimationManager> ().jumpUp.speedAnimation = 1.0f;
		player01.GetComponent<AnimationManager> ().jumpLoop.animation = (AnimationClip)objs[307];
		player01.GetComponent<AnimationManager> ().jumpLoop.speedAnimation = 1.0f;
		player01.GetComponent<AnimationManager> ().jumpDown.animation = (AnimationClip)objs[306];
		player01.GetComponent<AnimationManager> ().jumpDown.speedAnimation = 1.0f;
		player01.GetComponent<AnimationManager> ().roll.animation = (AnimationClip)objs[309];
		player01.GetComponent<AnimationManager> ().roll.speedAnimation = 1.0f;
		player01.GetComponent<AnimationManager> ().dead.animation = (AnimationClip)objs[132];
		player01.GetComponent<AnimationManager> ().dead.speedAnimation = 1.0f;
		player01.AddComponent<Controller>();
		GameObject get_Item_For_Delete = player01.transform.Find ("Get_Item_For_Delete").gameObject;
		GameObject magnetCollision = player01.transform.Find ("MagnetCollision").gameObject;
		DestroyImmediate(magnetCollision.GetComponent<Magnet>(),true);
		magnetCollision.AddComponent<Magnet>();
		DestroyImmediate(get_Item_For_Delete.GetComponent<CoinRotation>(),true);
		get_Item_For_Delete.AddComponent<CoinRotation>();
		player01.GetComponent<Controller>().coinRotate = get_Item_For_Delete.GetComponent<CoinRotation>();
		player01.GetComponent<Controller> ().magnet = magnetCollision;
		player01.GetComponent<Controller> ().speedMove = 5;
		player01.GetComponent<Controller> ().gravity = 20;
		player01.GetComponent<Controller> ().jumpValue = 7;
		player01.GetComponent<Controller> ().keyInput = true;
		player01.GetComponent<Controller> ().touchInput = true;
		
		
		GameObject colliderSpawn = spawnobjPref.transform.Find ("ColliderSpawn").gameObject;
		DestroyImmediate (colliderSpawn.GetComponent<ColliderSpawnCheck> (), true);
		colliderSpawn.AddComponent<ColliderSpawnCheck>();
		colliderSpawn.GetComponent<ColliderSpawnCheck> ().nameColliderHit = player01.name;
		colliderSpawn.GetComponent<ColliderSpawnCheck> ().checkByName = true;
		colliderSpawn.GetComponent<ColliderSpawnCheck> ().checkByTag = true;
		
		///////////////////////////////////////////////////////////////////////////////////////////////////////
		
		
		GameObject player02 = bundle.Load("Player_2" ,typeof (GameObject)) as GameObject;
		GameObject.Find("GameController").GetComponent<GameController>().playerPref[1] = player02;
		DestroyImmediate(player02.GetComponent<Controller>(),true);
		DestroyImmediate(player02.GetComponent<AnimationManager>(),true);
		player02.AddComponent<AnimationManager>();
		player02.GetComponent<AnimationManager > ().run.animation=(AnimationClip)objs[310];
		player02.GetComponent<AnimationManager> ().run.speedAnimation = 1.5f;
		player02.GetComponent<AnimationManager> ().turnLeft.animation = (AnimationClip)objs[311];
		player02.GetComponent<AnimationManager> ().turnLeft.speedAnimation = 1.25f;
		player02.GetComponent<AnimationManager> ().turnRight.animation = (AnimationClip)objs[312];
		player02.GetComponent<AnimationManager> ().turnRight.speedAnimation = 1.25f;
		player02.GetComponent<AnimationManager> ().jumpUp.animation = (AnimationClip)objs[308];
		player02.GetComponent<AnimationManager> ().jumpUp.speedAnimation = 1.0f;
		player02.GetComponent<AnimationManager> ().jumpLoop.animation = (AnimationClip)objs[307];
		player02.GetComponent<AnimationManager> ().jumpLoop.speedAnimation = 1.0f;
		player02.GetComponent<AnimationManager> ().jumpDown.animation = (AnimationClip)objs[306];
		player02.GetComponent<AnimationManager> ().jumpDown.speedAnimation = 1.0f;
		player02.GetComponent<AnimationManager> ().roll.animation = (AnimationClip)objs[309];
		player02.GetComponent<AnimationManager> ().roll.speedAnimation = 1.0f;
		player02.GetComponent<AnimationManager> ().dead.animation = (AnimationClip)objs[132];
		player02.GetComponent<AnimationManager> ().dead.speedAnimation = 1.0f;
		player02.AddComponent<Controller>();
		GameObject get_Item_For_Delete02 = player02.transform.Find ("Get_Item_For_Delete").gameObject;
		GameObject magnetCollision02 = player02.transform.Find ("MagnetCollision").gameObject;
		DestroyImmediate(magnetCollision02.GetComponent<Magnet>(),true);
		magnetCollision02.AddComponent<Magnet>();
		DestroyImmediate(get_Item_For_Delete02.GetComponent<CoinRotation>(),true);
		get_Item_For_Delete02.AddComponent<CoinRotation>();
		player02.GetComponent<Controller>().coinRotate = get_Item_For_Delete02.GetComponent<CoinRotation>();
		player02.GetComponent<Controller> ().magnet = magnetCollision02;
		player02.GetComponent<Controller> ().speedMove = 5;
		player02.GetComponent<Controller> ().gravity = 20;
		player02.GetComponent<Controller> ().jumpValue = 7;
		player02.GetComponent<Controller> ().keyInput = true;
		player02.GetComponent<Controller> ().touchInput = true;
		////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
		
		DestroyImmediate (GameObject.Find ("Building01").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building01").AddComponent<MeshFilter> ().mesh = (Mesh)objs[152];
		DestroyImmediate (GameObject.Find("Building01").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building01").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building01").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material11);
		GameObject.Find ("Building01").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building01").GetComponent<MeshRenderer> ().materials [0].name =material11.name;
		GameObject.Find ("Building01").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building01").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building02").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building02").AddComponent<MeshFilter> ().mesh = (Mesh)objs[152];
		DestroyImmediate (GameObject.Find("Building02").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building02").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building02").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material11);
		GameObject.Find ("Building02").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building02").GetComponent<MeshRenderer> ().materials [0].name =material11.name;
		GameObject.Find ("Building02").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building02").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building03").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building03").AddComponent<MeshFilter> ().mesh = (Mesh)objs[152];
		DestroyImmediate (GameObject.Find("Building03").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building03").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building03").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material12);
		GameObject.Find ("Building03").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building03").GetComponent<MeshRenderer> ().materials [0].name =material12.name;
		GameObject.Find ("Building03").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building03").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building04").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building04").AddComponent<MeshFilter> ().mesh = (Mesh)objs[152];
		DestroyImmediate (GameObject.Find("Building04").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building04").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building04").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material13);
		GameObject.Find ("Building04").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building04").GetComponent<MeshRenderer> ().materials [0].name =material13.name;
		GameObject.Find ("Building04").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building04").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building05").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building05").AddComponent<MeshFilter> ().mesh = (Mesh)objs[152];
		DestroyImmediate (GameObject.Find("Building05").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building05").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building05").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material14);
		GameObject.Find ("Building05").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building05").GetComponent<MeshRenderer> ().materials [0].name =material14.name;
		GameObject.Find ("Building05").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building05").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building06").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building06").AddComponent<MeshFilter> ().mesh = (Mesh)objs[152];
		DestroyImmediate (GameObject.Find("Building06").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building06").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building06").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material15);
		GameObject.Find ("Building06").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building06").GetComponent<MeshRenderer> ().materials [0].name =material15.name;
		GameObject.Find ("Building06").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building06").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building07").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building07").AddComponent<MeshFilter> ().mesh = (Mesh)objs[155];
		DestroyImmediate (GameObject.Find("Building07").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building07").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building07").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material10);
		GameObject.Find ("Building07").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building07").GetComponent<MeshRenderer> ().materials [0].name =material10.name;
		GameObject.Find ("Building07").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building07").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building08").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building08").AddComponent<MeshFilter> ().mesh = (Mesh)objs[155];
		DestroyImmediate (GameObject.Find("Building08").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building08").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building08").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material10);
		GameObject.Find ("Building08").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building08").GetComponent<MeshRenderer> ().materials [0].name =material10.name;
		GameObject.Find ("Building08").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building08").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building09").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building09").AddComponent<MeshFilter> ().mesh = (Mesh)objs[155];
		DestroyImmediate (GameObject.Find("Building09").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building09").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building09").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material10);
		GameObject.Find ("Building09").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building09").GetComponent<MeshRenderer> ().materials [0].name =material10.name;
		GameObject.Find ("Building09").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building09").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building10").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building10").AddComponent<MeshFilter> ().mesh = (Mesh)objs[155];
		DestroyImmediate (GameObject.Find("Building10").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building10").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building10").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material11);
		GameObject.Find ("Building10").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building10").GetComponent<MeshRenderer> ().materials [0].name =material11.name;
		GameObject.Find ("Building10").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building10").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building11").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building11").AddComponent<MeshFilter> ().mesh = (Mesh)objs[155];
		DestroyImmediate (GameObject.Find("Building11").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building11").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building11").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material12);
		GameObject.Find ("Building11").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building11").GetComponent<MeshRenderer> ().materials [0].name =material12.name;
		GameObject.Find ("Building11").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building11").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building12").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building12").AddComponent<MeshFilter> ().mesh = (Mesh)objs[155];
		DestroyImmediate (GameObject.Find("Building12").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building12").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building12").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material13);
		GameObject.Find ("Building12").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building12").GetComponent<MeshRenderer> ().materials [0].name =material13.name;
		GameObject.Find ("Building12").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building12").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building13").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building13").AddComponent<MeshFilter> ().mesh = (Mesh)objs[155];
		DestroyImmediate (GameObject.Find("Building13").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building13").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building13").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material14);
		GameObject.Find ("Building13").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building13").GetComponent<MeshRenderer> ().materials [0].name =material14.name;
		GameObject.Find ("Building13").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building13").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building14").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building14").AddComponent<MeshFilter> ().mesh = (Mesh)objs[155];
		DestroyImmediate (GameObject.Find("Building14").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building14").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building14").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material15);
		GameObject.Find ("Building14").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building14").GetComponent<MeshRenderer> ().materials [0].name =material15.name;
		GameObject.Find ("Building14").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building14").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building15").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building15").AddComponent<MeshFilter> ().mesh = (Mesh)objs[155];
		DestroyImmediate (GameObject.Find("Building15").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building15").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building15").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material15);
		GameObject.Find ("Building15").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building15").GetComponent<MeshRenderer> ().materials [0].name =material15.name;
		GameObject.Find ("Building15").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building15").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		DestroyImmediate (GameObject.Find ("Building16").GetComponent<MeshFilter> (), true);
		GameObject.Find ("Building16").AddComponent<MeshFilter> ().mesh = (Mesh)objs[155];
		DestroyImmediate (GameObject.Find("Building16").GetComponent<MeshRenderer>(),true);
		GameObject.Find ("Building16").AddComponent<MeshRenderer> ();
		GameObject.Find ("Building16").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material15);
		GameObject.Find ("Building16").GetComponent<MeshRenderer> ().materials [0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("Building16").GetComponent<MeshRenderer> ().materials [0].name =material15.name;
		GameObject.Find ("Building16").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("Building16").GetComponent<MeshRenderer> ().receiveShadows = true;
		
		
		
		
		
		
		DestroyImmediate (GameObject.Find("modelRoad01").GetComponent<MeshFilter>(),true);
		GameObject.Find("modelRoad01").AddComponent<MeshFilter>().mesh=(Mesh)objs[176];
		DestroyImmediate (GameObject.Find("modelRoad01").GetComponent<MeshRenderer>(),true);
		GameObject.Find("modelRoad01").AddComponent<MeshRenderer>();
		GameObject.Find ("modelRoad01").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material4);
		GameObject.Find("modelRoad01").GetComponent<MeshRenderer>().materials[0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("modelRoad01").GetComponent<MeshRenderer> ().materials [0].name =material4.name;
		GameObject.Find ("modelRoad01").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("modelRoad01").GetComponent<MeshRenderer> ().receiveShadows = true;
		DestroyImmediate (GameObject.Find ("modelRoad01").GetComponent<MeshCollider> (), true);
		GameObject.Find("modelRoad01").AddComponent<MeshCollider>();
		GameObject.Find ("modelRoad01").GetComponent<MeshCollider> ().sharedMesh = (Mesh)objs [176];
		
		
		
		
		
		
		DestroyImmediate (GameObject.Find("modelRoad02").GetComponent<MeshFilter>(),true);
		GameObject.Find("modelRoad02").AddComponent<MeshFilter>().mesh=(Mesh)objs[176];
		DestroyImmediate (GameObject.Find("modelRoad02").GetComponent<MeshRenderer>(),true);
		GameObject.Find("modelRoad02").AddComponent<MeshRenderer>();
		GameObject.Find ("modelRoad02").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material4);
		GameObject.Find("modelRoad02").GetComponent<MeshRenderer>().materials[0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("modelRoad02").GetComponent<MeshRenderer> ().materials [0].name =material4.name;
		GameObject.Find ("modelRoad02").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("modelRoad02").GetComponent<MeshRenderer> ().receiveShadows = true;
		DestroyImmediate (GameObject.Find ("modelRoad02").GetComponent<MeshCollider> (), true);
		GameObject.Find("modelRoad02").AddComponent<MeshCollider>();
		GameObject.Find ("modelRoad02").GetComponent<MeshCollider> ().sharedMesh = (Mesh)objs [176];
		
		
		
		
		
		DestroyImmediate (GameObject.Find("modelRoad03").GetComponent<MeshFilter>(),true);
		GameObject.Find("modelRoad03").AddComponent<MeshFilter>().mesh=(Mesh)objs[176];
		DestroyImmediate (GameObject.Find("modelRoad03").GetComponent<MeshRenderer>(),true);
		GameObject.Find("modelRoad03").AddComponent<MeshRenderer>();
		GameObject.Find ("modelRoad03").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material4);
		GameObject.Find("modelRoad03").GetComponent<MeshRenderer>().materials[0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("modelRoad03").GetComponent<MeshRenderer> ().materials [0].name =material4.name;
		GameObject.Find ("modelRoad03").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("modelRoad03").GetComponent<MeshRenderer> ().receiveShadows = true;
		DestroyImmediate (GameObject.Find ("modelRoad03").GetComponent<MeshCollider> (), true);
		GameObject.Find("modelRoad03").AddComponent<MeshCollider>();
		GameObject.Find ("modelRoad03").GetComponent<MeshCollider> ().sharedMesh = (Mesh)objs [176];
		
		
		
		
		
		DestroyImmediate (GameObject.Find("modelRoad04").GetComponent<MeshFilter>(),true);
		GameObject.Find("modelRoad04").AddComponent<MeshFilter>().mesh=(Mesh)objs[176];
		DestroyImmediate (GameObject.Find("modelRoad04").GetComponent<MeshRenderer>(),true);
		GameObject.Find("modelRoad04").AddComponent<MeshRenderer>();
		GameObject.Find ("modelRoad04").GetComponent<MeshRenderer> ().materials [0].CopyPropertiesFromMaterial(material4);
		GameObject.Find("modelRoad04").GetComponent<MeshRenderer>().materials[0].shader=
			(Shader)Resources.LoadAssetAtPath("Assets/Endless Run/Shader/Curved.shader",typeof(Shader));
		GameObject.Find ("modelRoad04").GetComponent<MeshRenderer> ().materials [0].name =material4.name;
		GameObject.Find ("modelRoad04").GetComponent<MeshRenderer> ().castShadows = true;
		GameObject.Find ("modelRoad04").GetComponent<MeshRenderer> ().receiveShadows = true;
		DestroyImmediate (GameObject.Find ("modelRoad04").GetComponent<MeshCollider> (), true);
		GameObject.Find("modelRoad04").AddComponent<MeshCollider>();
		GameObject.Find ("modelRoad04").GetComponent<MeshCollider> ().sharedMesh = (Mesh)objs [176];
		
		
		////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
		GameObject.Find ("SoundManager").GetComponent<SoundManager> ().sound_List [0].audioClip = (AudioClip)objs [82];
		GameObject.Find ("SoundManager").GetComponent<SoundManager> ().sound_List [1].audioClip = (AudioClip)objs [218];
		GameObject.Find ("SoundManager").GetComponent<SoundManager> ().sound_List [2].audioClip = (AudioClip)objs [112];
		GameObject.Find ("SoundManager").GetComponent<SoundManager> ().sound_List [3].audioClip = (AudioClip)objs [106];
		GameObject.Find ("SoundManager").GetComponent<SoundManager> ().sound_List [4].audioClip = (AudioClip)objs [218];
		GameObject.Find ("SoundManager").GetComponent<SoundManager> ().sound_List [5].audioClip = (AudioClip)objs [218];
		GameObject.Find ("SoundManager").GetComponent<AudioSource> ().clip = (AudioClip)objs [28];
		
		
		
		
		
		
		
		
		
		bundle.Unload(false);
		yield return www;
		
		
	}
}

几条主要代码分析:

Material material0 = bundle.Load("Board" ,typeof (Material)) as Material;

在.unity3d的包中寻找名字为Board的第一个资源,注意:是第一个,同名的第二个、三个。。。。。。这样找不到。

解决办法有两种:

第一种是在资源包命名时改掉同名的资源包

第二种是:

WWW www = WWW.LoadFromCacheOrDownload (url, 4);
        //加载失败
        if(www.error != null)
        {
            Debug.Log("Load Bundle Faile " + url + " Error Is " + www.error);
            yield break;
        }
        
        AssetBundle bundle = www.assetBundle;
        Object[] objs = bundle.LoadAll();

for(int i =0;i< objs.Length;i++){

if(objs[i].name.Equals("Board")){
                Debug.Log("bgm - Bounce_It的index="+i);
            }

}

通过objs[  index  ]得到同名的资源对象。

 

 

 

    
        GameObject itemPref4 = bundle.Load("Item_Jump" ,typeof (GameObject)) as GameObject;
        GameObject.Find("PatternSystemManager").GetComponent<PatternSystem>().item_Pref[4]=itemPref4;
        DestroyImmediate(itemPref4.GetComponent<Item>(),true);

因为之前的Item组件里面的内容都missing了,但如果直接加进去会加不进去参数值,所以要先删除组件。
     

 

 

   itemPref4.AddComponent<Item>();

删除完组件再加入Item组件,再重新加参数可以加进来。

       

 

       itemPref4.GetComponent<Item> ().scoreAdd = 2;
        itemPref2.GetComponent<Item> ().decreaseLife = 1;
        itemPref2.GetComponent<Item> ().speedMove = 0;
        itemPref2.GetComponent<Item> ().duration = 15;
        itemPref2.GetComponent<Item> ().itemEffectValue = 0;

 

GameObject  itemPref2 = bundle.Load("Coin02" ,typeof (GameObject)) as GameObject;
        GameObject Cylinder = itemPref2.transform.Find ("Cylinder").gameObject;

有的资源利用名字和objs[  index  ]都查找不到,如Cylinder,因为它是资源Coin02的子对象。找到Coin02对象后,利用itemPref2.transform.Find ("Cylinder").gameObject;找到子对象Cylinder。

 

 

 

然后将c#文件myassets拖进Main Camera

⑤运行遇到错误。

需要更改一下。

⑥运行又遇到错误。

错误在下面:

把代码改为一下这样:

 

 

没有更多推荐了,返回首页