摘要:Unity3D游戏引擎一共支持4个音乐格式的文件.AIFF 适用于较短的音乐文件可用作游戏打斗音效.WAV 适用于较短的音乐文件可用作游戏打斗音效.MP3 适用于较长的音乐文件可用作游戏背景音乐.OGG 适用于较长的音乐文件可用作游戏背景音乐在场景中创建一个空的游戏对象。GameObject -> ...
阅读全文
摘要:#pragma strict//接收外部字符串var str :String;//接收外部赋值贴图var InageTexture: Texture;//贴图高度private var Imageheigth:int;//贴图宽度private var Imagewidth:int;//当前屏幕高度private var screenheigth:int;//当前屏幕宽度private var screenwidth:int;function Start () {//得到屏幕高宽screenheigth=Screen.height;screenwidth=Screen.width;//得到贴图
阅读全文
摘要:方法01------------------------JS访问C#的变量-----------------------------JS脚本:import System.Reflection;var ee = 0;var ddf:GameObject;function OnGUI (){var targetController1:Component= ddf.GetComponent("ctrl");var fieldInfo: FieldInfo=targetController1.GetType().GetField("csvalue");if(GU
阅读全文
摘要:#pragma strictvar TranslaSpeed=20;var RotateSpeed=1000;function Start () {}function Update () {}function OnGUI(){GUI.backgroundColor=Color.red;if(GUI.Button(Rect(10,10,70,30),"向左旋转")){transform.Rotate(Vector3.up*Time.deltaTime*(-RotateSpeed));}if(GUI.Button(Rect(90,10,70,30),"向前移动&quo
阅读全文
摘要:voidAwake(){}//初始化函数,在游戏开始时系统自动调用。一般用来创建变量之类的东西。voidStart(){}//初始化函数,在所有Awake函数运行完之后(一般是这样,但不一定),在所有Update函数前系统自动条用。一般用来给变量赋值。我们通常书写的脚本,并不会定义[ExecuteInEditMode]这个Attribute,所以Awake和Start都只有在Runtime中才会执行。using UnityEngine;using System.Collections;public class square1 : MonoBehaviour { public float ...
阅读全文