Unity3d
jian11058
信义著于四海,匡扶汉室
展开
-
unity 设置模型看向玩家
using System.Collections;using System.Collections.Generic;using UnityEngine;public class watch : MonoBehaviour{ private Vector3 old; // Start is called before the first frame update void Start() { old = transform.eulerAngl...原创 2021-05-18 22:39:19 · 493 阅读 · 0 评论 -
unity GUI弹窗
using System.Collections;using System.Collections.Generic;using UnityEngine;public class window_manager : MonoBehaviour{ private bool isShow = false; private Rect windowRect ; private AudioSource audioSource; private int marg...原创 2021-05-16 20:23:08 · 779 阅读 · 1 评论 -
unity RawImage ui的鼠标事件处理、日志打印、纹理更换,进入其他场景
using System.Collections;using System.Collections.Generic;using UnityEngine;//using UnityEngine.Events;//using UnityEngine.EventSystems;using UnityEngine.UI;using UnityEngine.Events;using UnityEngine.EventSystems;public class menu_start : Mon...原创 2021-05-16 10:24:36 · 293 阅读 · 0 评论 -
unity 鼠标事件、改变纹理RawImage。图片改变纹理
using System.Collections;using System.Collections.Generic;using UnityEngine;public class mouse : MonoBehaviour{ public Color oldColor; public bool isPlay=false; // Start is called before the first frame update void Start()...原创 2021-05-15 22:30:53 · 816 阅读 · 0 评论 -
unity 初速度
using System.Collections;using System.Collections.Generic;using UnityEngine;public class firstSpeed : MonoBehaviour{ public float speed = 5.0f; float lastSpeed; // Start is called before the first frame update void Start() {...原创 2021-05-15 22:29:29 · 1206 阅读 · 0 评论 -
unity 协同程序,延迟执行、动态删除脚本、添加脚本、数组
using System.Collections;using System.Collections.Generic;using UnityEngine;public class target_down : MonoBehaviour{ private Animation animation; private bool isTargeted; // Start is called before the first frame update void Star...原创 2021-05-15 11:14:25 · 247 阅读 · 0 评论 -
The type or namespace name ‘UI‘ could not be found (are you missing a using directive or an assembly
增加导入:using UnityEngine.UI;原创 2021-05-12 09:47:42 · 1178 阅读 · 0 评论 -
unity OnTriggerEnter碰撞器
using System.Collections;using System.Collections.Generic;using UnityEngine;public class tig : MonoBehaviour{ // Start is called before the first frame update void Start() { } // Update is called once per frame ...原创 2021-05-11 20:40:26 · 204 阅读 · 0 评论 -
unity cs光线投射 Physics.Raycast,父场景播放动画;
在角色控制器上创建脚本:关键字:out,表示输出该对象;光线投射到的场景上,需要将它的标签设置为:"playDoor"与脚本中的一致即可;using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;public class playercollisions : MonoBehaviour{ // Start is called bef...原创 2021-05-11 10:26:30 · 263 阅读 · 0 评论 -
unity cs 播放声音,父控件的动画,延时操作,计时,OnControllerColliderHit检测角色和其他物理碰撞的回调
using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEditor;public class playercollisions : MonoBehaviour{ private bool doorisopen = false; private float doortime = 0.0f; private GameObject curr...原创 2021-05-10 22:40:31 · 612 阅读 · 0 评论 -
unity 角色控制器初始化CharacterController、CollisionFlags初始化
CharacterController controller =GetComponent<CharacterController>(); CollisionFlags flags = controller.Move(movedirection * Time.deltaTime);原创 2021-05-10 10:27:03 · 639 阅读 · 0 评论 -
Unity 2020设置天空盒
Window->Rendering->lighting->在属性面板中选择:Environment原创 2021-05-07 17:04:22 · 1726 阅读 · 0 评论 -
Unity3d 销毁物体
using System.Collections;using System.Collections.Generic;using UnityEngine;public class destroy : MonoBehaviour{ // Start is called before the first frame update void Start() { Destroy(gameObject, 3.0f);//3秒后销毁 } ...原创 2021-05-07 09:38:56 · 1025 阅读 · 0 评论 -
Unity3d cs 移动、旋转、升降、开火发射子弹功能、using UnityEngine.UI、Instantiate实例化物体
using System.Collections;using System.Collections.Generic;using UnityEngine;public class sheji : MonoBehaviour{ // Start is called before the first frame update void Start() { } private int speed = 5; public Tra...原创 2021-05-07 09:37:24 · 877 阅读 · 0 评论