随笔分类 - unity3D
摘要:unity3d通过串口接收Arduino数据 using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO.Ports; using System; using Syste
阅读全文
摘要:unity3d 动态改变物体的位置 using UnityEngine; public class MoveObject : MonoBehaviour { void Start() { // GameObject myObject = GameObject.Find("myObject"); if
阅读全文
摘要:using System.IO; using UnityEngine; using UnityEngine.UI; public class SaveRawImageAsPNG : MonoBehaviour { public RawImage rawImage; public void SaveI
阅读全文
摘要:unity3d碰撞 Unity3D提供了多个碰撞事件函数,用于处理不同类型的碰撞情况。常用的碰撞事件函数包括: OnCollisionEnter:当两个物体开始碰撞时触发。这是碰撞的起始点,可以用于执行碰撞开始时的逻辑,如播放碰撞音效、改变游戏状态等。 OnCollisionStay:在两个物体持续
阅读全文
摘要:unity3d Dictionary 根据key获取value using System; using System.Collections.Generic; using UnityEngine; public class DictionaryExample : MonoBehaviour { pr
阅读全文
摘要:unity3d缩放物体 using UnityEngine; public class ScaleObject : MonoBehaviour { // 缩放速度,可以根据需要调整 public float scaleSpeed = 0.1f; // 控制缩放的方向,这里以X轴为例 public b
阅读全文
摘要:InvalidOperationException: Insecure connection not allowed 在Edit -> Project Settings -> Player中找到平台设置(比如“PC, Mac & Linux Standalone”或者你的目标平台),然后滚动到底部找
阅读全文
摘要:unity3d get post请求 using UnityEngine; using UnityEngine.Networking; public class NetworkRequestExample : MonoBehaviour { IEnumerator Start() { string
阅读全文
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; using Mono.Data.Sqlite; // 注意:这取决于你使用的SQLite库 public class SQLiteExampl
阅读全文
摘要:unity3d 读取串口 using System.IO.Ports; using UnityEngine; public class SerialCommunication : MonoBehaviour { SerialPort mySerialPort = new SerialPort("CO
阅读全文
摘要:using System.Collections; using System.Collections.Generic; using UnityEngine; public class VCCameraWorkerController : MonoBehaviour { public Vector3
阅读全文
摘要:unity3d 清空控制台 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using AssemblyCSharp; using System;
阅读全文
摘要:unity3d BestHTTP #region /// <summary> /// 调用http接口 /// </summary> private void StartRequestData() {// BestHttp插件, 首先实例化一个HTTPRequest, 设置为Post形式, 并配置回
阅读全文
摘要:Unity3D中的UnityWebRequest是用于发送HTTP请求和处理HTTP响应的类。它提供了一种方便的方式来从服务器获取数据,例如从Web服务器的数据库中检索数据,并通过HTTP请求将数据发送回Unity3D应用程序。 使用UnityWebRequest类,您可以执行以下操作: 创建请求:
阅读全文
摘要:x y z -75.61 21.43 127.96 -75.61 21.43 108.66-10.5 21.43 127.96 长:66.3 宽:20.35
阅读全文
摘要:unity3d修改对象属性 #region void loadWorkerModel(Vector3 init_position, string worker_name,string BDID) { GameObject obj = (GameObject)Instantiate(Resources
阅读全文
摘要:unity3d添加刚体、质量 this.gameObject.AddComponent<Rigidbody>(); this.gameObject.GetComponent<Rigidbody>().mass = 10.01f; #################
阅读全文
摘要:unity3d旋转 Quaternion target = Quaternion.Euler(0.0f, tower_z_angle * (1.0f) , 0.0f); this.transform.Find("CraneSlider").transform.rotation = Quaternio
阅读全文
摘要:桁架系统模拟 //键盘控制 void ControllerObjectByKeyBoard() { if (Input.GetKey(KeyCode.LeftShift) && Input.GetKey(KeyCode.W)) { // 获取Player变量指定的对象的三围坐标 Vector3 ar
阅读全文
摘要:unity3d给某个对象添加材质 public void SetMaterial() { GameObject indexGameObject=list_topIfcSlabs[5]; Renderer[] renders = indexGameObject.GetComponentsInChild
阅读全文