加载中
点击按钮图片的响应

图片按钮的两态变化鼠标左键按下down和弹起up所触发的事件 编写两个脚本文件 一个是点击按钮的图片变化(UI代码 using UnityEngine; using System.Collections; public class MyUIButton : M...

图片闪烁效果

using UnityEngine; using System.Collections; public class ShowHide : MonoBehaviour { public Texture2D img; void Update () { if (Time.time % 2 < 1) { guiTexture.texture = img; } ...

鼠标抓取gameobject(类似碰撞检测)

using UnityEngine; using System.Collections; public class Mouse : MonoBehaviour { Ray ray; RaycastHit hit; void Update() { if (Input.GetMouseButton(0)) { ray = Camera.main.Scree...

在编辑器中添加菜单以及菜单项

using UnityEngine; using UnityEditor; public class Example { [MenuItem("new Menu/new/new new/new item")] static void showDialog() { EditorUtility.DisplayDialog("title","messsage...

move

#pragma strict var Speed = 50; function Update() { if(Input.GetKey(KeyCode.W)) { transform.Translate(Vector3.forward * Time.deltaTime *Speed); } else if(Input.GetKey(KeyCode.S))...

DistanceActive

using UnityEngine; using System.Collections; public class DistanceActive : MonoBehaviour { public GameObject station; private float distance; // Use this for initialization void...

DirectionGUI

using UnityEngine; using System.Collections; public class DirectionGUI : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void...

light

using UnityEngine; using System.Collections; public class dengguang : MonoBehaviour { public float hSbarValue1; public float hSbarValue3; public Light light; void OnGUI() { hSba...

DirectionGUI

// Use this for initialization void Start () { } // Update is called once per frame void Update () { } void OnGUI(){ if(GUI.Button(new Rect (Screen.width - 150,Screen.height - 1...

show XYZ

#pragma strict var player : GameObject; function OnGUI() { // Print the x component of the position to the Console print( " X " +transform.position.x+ " Y "+transform.position.y...

设定执行程序运行后的屏幕大小和屏幕坐标

算不是一篇完整的教程了,其实就是一段功能实现代码,平时大家可能也不怎么会用到,但如果是用unity3d来做一些投影项目的话,此段代码就是非常的有用了。此段代码主要的功能就是可以精确方便...

TakeScreenshot

//TakeScreenshot.cs // TODO: // By default, screenshot files are placed next to the executable bundle -- we don't want this in a // shipping game, as it will fail if the user do...

tempTime

var tempTime : float; var speed=0.1; function Start() { tempTime = 0;//初始aphal值 renderer.material.color.a=tempTime*speed; } function Update () { print(renderer.material.color...

没有更多内容

加载失败,请刷新页面

返回顶部
顶部