Android+Unity游戏开发之C#线程
2012-03-29 10:12
579 查看
Android+Unity游戏开发之C#线程
以前我们都是用javascript开发unity的,但是我今天才发现个问题,那就是javascript里面没有线程。没办法我只能用C#了,其实C#和java才不多的,有我们的线程,下面我就举个简单的例子来说明一下吧;
using UnityEngine;
using System.Collections;
using System.Threading;
public class move1: MonoBehaviour {
void Start () {
MyThread mt = new MyThread("thread");
Thread newnewThrd = new Thread(new ThreadStart(mt.run));
newThrd.Start();
}
void Update(){}
}
public class MyThread
{
public int count;
string thrdName;
public MyThread(string nam)
{
count = 0;
thrdName = nam;
}
public void run()
{
Debug.Log(thrdName);
}
}
我也不说多的了,C#我也还没学过,还好学过了java了,大家一定要记得加using system.Threading哦~~~。
以前我们都是用javascript开发unity的,但是我今天才发现个问题,那就是javascript里面没有线程。没办法我只能用C#了,其实C#和java才不多的,有我们的线程,下面我就举个简单的例子来说明一下吧;
using UnityEngine;
using System.Collections;
using System.Threading;
public class move1: MonoBehaviour {
void Start () {
MyThread mt = new MyThread("thread");
Thread newnewThrd = new Thread(new ThreadStart(mt.run));
newThrd.Start();
}
void Update(){}
}
public class MyThread
{
public int count;
string thrdName;
public MyThread(string nam)
{
count = 0;
thrdName = nam;
}
public void run()
{
Debug.Log(thrdName);
}
}
我也不说多的了,C#我也还没学过,还好学过了java了,大家一定要记得加using system.Threading哦~~~。
相关文章推荐
- android+unity游戏开发之常用的属性
- Android游戏开发---View线程绘动画与显示总结
- android+unity游戏开发基础之场景的切换
- Android 游戏开发之线程Thread延时开启和停止
- android+unity游戏开发基础之场景的切换
- android游戏开发学习笔记三(学习书籍 Android游戏编程之从零开始)
- 【Android游戏开发十六】Android Gesture之【触摸屏手势识别】操作!利用触摸屏手势实现一个简单切换图片的功能!
- 【Android游戏开发二十七】讲解游戏开发与项目下的hdpi 、mdpi与ldpi资源文件夹以及游戏高清版本的设置
- Android游戏开发:游戏框架的搭建(2)
- android游戏开发之我的小小游戏2——连连看游戏3连连看算法1
- 【读书笔记《Android游戏编程之从零开始》】4.Android 游戏开发常用的系统控件(EditText、CheckBox、Radiobutton)
- Android游戏开发之onTouchEvent
- Android开发实践:JNI层线程回调Java函数示例
- 为什么使用C#开发游戏?
- Xamarin Mono For Android 4.6.07004 完整离线安装破解版(C#开发Android、IOS工具)
- 【Android】 Canvas、Path 和 Paint 实例 (游戏开发必备)
- Android游戏开发使用View还是SurfaceView
- C#开发WPF/Silverlight动画及游戏系列教程(Game Tutorial):(九) 2D游戏角色在地图上的移动
- Android游戏开发使用View还是SurfaceView
- Android游戏开发 study 8-10