自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(48)
  • 收藏
  • 关注

原创 创建和获取桌面文档

using System.Collections;using System.Collections.Generic;using UnityEngine;using System;public class ceshi : MonoBehaviour{ string ss = "你是谁"; // Start is called before the first frame update void Start() { //创建桌面文档 .

2022-03-30 16:55:40 156

原创 修改物体材质状态及颜色

foreach (Transform child in GetComponentsInChildren<Transform>(true)) { if (child.gameObject.GetComponent<Renderer>() != null) { if (child.gameObject.GetComponent<Renderer>().materials != n.

2022-03-18 15:50:51 289

原创 text空格换行

// "\u3000"空格 "\n"换行 text.text=text.text+ "\u3000"+_name; text.text=text.text+ "\n" + _name;

2021-01-05 11:31:44 190

原创 进入退出

2020-05-26 12:40:06 167

原创 改变材质,改变材质颜色,改变材质透明状态

两个代码,1。材质原代码,放入项目。2.调用方法,挂在物体上01:::using System.Collections;using System.Collections.Generic;using UnityEngine;public class MaterialModify : MonoBehaviour{ public enum RenderingMode...

2020-03-18 09:23:05 491

原创 button监听

//监听按钮事件 GetComponent<Button>().onClick.AddListener(() => {/*事件*/ OnClickShot(); });

2019-12-09 15:55:12 121

原创 物体出现在目标物体的某个方向

this.gameObject.transform.LookAt(VR_Camera.transform); this.gameObject.transform.position = VR_Camera.transform.position + VR_Camera.transform.forward * L; this.gameObject.tran...

2019-04-04 16:04:00 115

原创 物体旋转到指定角度

public float Speed; Quaternion targetAngels; public GameObject gam; // Use this for initialization void Start () { targetAngels = Quaternion.Euler(90, 0, 0); } ...

2019-04-04 14:42:26 855

原创 延时执行事件

private void OnTriggerEnter(Collider other) { if (other.gameObject.name == "Sphere") { Invoke("Load", 2);//延迟2秒物体消失 } } void Load() { this.g...

2019-03-29 17:35:54 389

原创 HTCVIVE手柄振动

using System;using System.Collections;using System.Collections.Generic;using UnityEngine;/// <summary>/// 手柄控制器脚本/// </summary>///public enum HandleControllerShakeType{ Defu...

2019-03-29 14:57:26 247

原创 htcvive手柄控制器

using System.Collections;using System.Collections.Generic;using UnityEngine;public class ShouBingKongZhiQi : MonoBehaviour { SteamVR_TrackedObject trackdeObject; //控制器 p...

2019-03-29 14:55:36 283

原创 手柄移动速度检测

using System.Collections;using System.Collections.Generic;using UnityEngine;public class ShouBingSuDuJianCe : MonoBehaviour { public Vector3 LastVec; float time = 0; public float...

2019-03-29 14:53:48 588

原创 物体朝向某一个点移动

在update里面运行float step = speed * Time.deltaTime; //物体朝向木一个点移动 gameObject.transform.localPosition = Vector3.MoveTowards(gameObject.transform.localPosition, new Vector3(149....

2019-03-06 09:42:01 1028

原创 移动震动

using System.Collections;using System.Collections.Generic;using UnityEngine;public class YiDongZhenDong : MonoBehaviour { public Transform Trans_Move; //判断的物...

2019-03-06 09:34:34 138

原创 给物体添加摄像机

1 创建一个新的摄像机挂在物体上2.创建一个RenderTexture 挂在摄像机上3.创建一个UI RAW Image图片,将RenderTexture贴图放上去完成

2019-02-19 17:25:02 158 1

原创 材质球图片的运动

using System.Collections;using System.Collections.Generic;using UnityEngine;public class PaTiJianTou : MonoBehaviour {       [Range(0f, 1f)]    public float speed_x = 0;    [Range(0f, 1f)]  ...

2019-02-15 14:07:47 172

原创 vrtk攀爬

头盔添加物体添加

2019-01-24 09:49:40 516

原创 开门

  using System.Collections;using System.Collections.Generic;using UnityEngine;public class GuiMen : MonoBehaviour {    public GameObject LeftShoubing;    private  Vector3 GuiMenMuBiao;...

2019-01-22 18:34:04 132

原创 按键短按长按

using System.Collections;using System.Collections.Generic;using UnityEngine;public class ShouBingMuLu : MonoBehaviour{    public GameObject MuLu;    public GameObject MuLu02;    public floa...

2019-01-22 18:26:21 1340

原创 判断物体自身位置是否发生变化,是,手柄震动

 using System.Collections;using System.Collections.Generic;using UnityEngine;public class YiDongZhenDong : MonoBehaviour {    public Transform Trans_Move;                                //判...

2019-01-09 17:41:43 949

原创 物体朝向某一个物体

void Update()    {        if (Eye != null)        {            this.transform.LookAt(Eye.transform);            this.transform.Translate(Vector3.forward * Time.deltaTime * Speed);        }   ...

2019-01-03 11:14:16 408

原创 随机

随机方法名就是Random.Range()

2018-12-22 14:59:31 107

原创 协程

 private void Update()    {        if (i == true)        {            i = false;            //等待三秒跳转铝包带            StartCoroutine(WaitEvent(3.0f));        // 括号中的数字就是等待的时间,按秒算        }  ...

2018-12-21 10:37:59 102

原创 手柄震动

using System;using System.Collections;using System.Collections.Generic;using UnityEngine;/// &lt;summary&gt;/// 手柄控制器脚本/// &lt;/summary&gt;/// public enum HandleControllerShakeType{    Defu...

2018-11-30 16:19:23 860 1

原创 头盔检测手柄距离显示ui

using System.Collections;using System.Collections.Generic;using UnityEngine;public class ShouBingUIJianCe : MonoBehaviour {    public Transform Head;//头    public Transform Hand;//手    publi...

2018-11-06 11:24:37 283

原创 物体自身旋转

void Update () {        if (LoGo != null)        {//物体以世界坐标自身旋转            LoGo.transform.Rotate(LoGo.transform.up * Time.deltaTime * Speed);        }    }void Update () {        if (LoGo ...

2018-10-15 09:11:18 456

原创 两点间生成直线

using System.Collections;using System.Collections.Generic;using UnityEngine;public class LiangDianJianDeLianXian : MonoBehaviour {      public GameObject WuTi01;    public GameObject WuTi02;...

2018-09-12 18:29:25 1231 1

原创 调用某物体的子物体和子物体孙物体

 public class UI_RingtButton : MonoBehaviour {    public GameObject ZheZhao;     public GameObject Right_Canvas;    public void JiChu_Button()    {        foreach(Transform child in Right_C...

2018-08-24 12:52:33 233

原创 VR中手柄射线一直存在的和UI选择按钮点击按钮的设置

VR中射线一直出现的设置UI收并射线选开关的设置 

2018-08-24 12:37:31 3899 2

原创 子物体的控制

//子物体的隐藏foreach(Transform child in this.GetComponent&lt;Transform&gt;()){if (child.name == "要隐藏的名字"){ if (child.gameObject.activeSelf == false){child.gameObject.SetActive(false);}else...

2018-08-14 08:54:55 220

原创 VRTK外圈高亮组件

2018-05-22 14:40:13 1314

原创 vrtk中抓取按键的修改

2018-05-18 19:18:24 835

原创 用枚举与switch...case...将事件的有序进行

using System.Collections;using System.Collections.Generic;using UnityEngine;public enum Daozhacaozuo{ Default,}public class DaoZhaCaoZuo : MonoBehaviour { public static DaoZha...

2018-05-08 17:50:46 151

原创 音效的管理和调用

using System.Collections;using System.Collections.Generic;using UnityEngine;public enum AudioClipType{    zhuoqian,    zhuazuoyepiao,    duzuoyepiao,    qianzikaimen}public class SoundController : Mon...

2018-05-08 17:40:23 162

原创 判断当前音效是否播放完毕

public class ZhuaZuoYePiao : MonoBehaviour {    public bool IsOnce = true;    public GameObject daimaoren;    public GameObject zuoyepiao;    void OnTriggerEnter(Collider other)    {                  ...

2018-05-08 17:36:48 9405 1

原创 抓取代码

public class ZhuaZuoYePiao : MonoBehaviour {    public bool IsOnce = true;    public GameObject daimaoren;    public GameObject zuoyepiao;    void OnTriggerEnter(Collider other)    {                  ...

2018-05-08 17:35:06 860

原创 触碰检测

using System.Collections;using System.Collections.Generic;using UnityEngine;public class ShuiHuScripts : MonoBehaviour {    public ModelXianShi xianShi;    public GameObject shuihuTS;    void OnTrigge...

2018-04-27 18:07:15 294

原创 动画插入事件脚本

using System.Collections;using System.Collections.Generic;using UnityEngine;/// &lt;summary&gt;/// 移动动画事件/// &lt;/summary&gt;public class MoveScript : MonoBehaviour {    public GameObject BiaoGan;    ...

2018-04-27 18:05:21 209

原创 vr头盔检测碰撞

using System.Collections;using System.Collections.Generic;using UnityEngine;public class EyeColliderScript : MonoBehaviour {    public GameObject qishi_TS;    public GameObject zuoyepiao_TS;    public...

2018-04-27 18:03:51 564

原创 给预制动画添加事件

这个不要

2018-04-27 18:01:01 191 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除