原创 c# try catch 用法

try catch finally 1、將預見可能引發異常的代碼包含在try語句塊中。 2、如果發生了異常,則轉入catch的執行。catch有幾種寫法: catch 這將捕獲任何發生的異常。 catch(Exception e) 這將捕

原创 Shader(固定管線着色器)

//第一種 Shader "VRShader/AlphaTestDemo" { Properties{ _AlphaValue("透明度值",Range(0,1))=0.5 _Color("主顏色",Colo

原创 Unity中Android開發環境搭建配置教程

Unity中Android開發環境搭建配置教程   Unity中進行安卓平臺開發需要哪些步驟呢?這裏對搭建配置步驟進行整理和總結。 一、下載安裝必備軟件 1.下載安裝Unity安卓支持插件 用Unity下載助手下載安卓支持插件UnityS

原创 Unity-賽車Demo

using UnityEngine; using System.Collections; public class CarDrive : MonoBehaviour { public WheelCollider wheelCo

原创 Unity-UGUI定時器(一)

using UnityEngine; using System.Collections; using UnityEngine.UI; public class Timer : MonoBehaviour { public fl

原创 Unity鼠標點擊地面控制人物移動

using UnityEngine; using System.Collections; public class Player : MonoBehaviour { static public Player instance;

原创 Unity-AR-EasyAR

  1.創建ImageTarget---圖片名直接法 首先我們把 ImageTarget 拖到面板中去   image   新建一個腳本"SampleImageTargetBehaviour" ,處理方法與之前相似:   image

原创 unity---鼠標控制攝像機圍繞某個物體旋轉

using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraRot : MonoBehaviour

原创 Shader(頂點片段着色器)

//第一種 Shader "VRShader/DiffuseShader" { Properties { _Color("MainColor", Color) = (1, 1, 1, 1) } SubShader {

原创 Unity-UGUI定時器(二)

using UnityEngine; using System.Collections; using UnityEngine.UI; public class Timer : MonoBehaviour { private f

原创 C#中的try catch 和finally

在c#中處理錯誤經常會使用這幾個關鍵字。本文介紹一下其用法 這三個關鍵字try是必定要用的,要不然就失去了意義。然後catch和finally可以不用但是要注意遵循原則 一個或多個catch的時候可以不用finally但是也可以用。

原创 Unity自制小時鐘

using UnityEngine; using System.Collections; using System; public class Clock : MonoBehaviour { //父物體的Transform,旋

原创 攝像機的旋轉,移動,縮放

using UnityEngine; using System.Collections; public class CamManualCtrl : MonoBehaviour { static public CamManualC

原创 Shader(表面着色器)

//第一種 Shader "VRShader/BaseSurfaceShader" { Properties { _Color("Color",Color)=(0,1,1,1) } SubShader { CGPROGR

原创 ScreenToViewportPoint,WorldToViewportPoint,ViewportToWorldPoint的運用,實現一個簡單的對三維中物體的拖拽移動效果

ScreenToViewportPoint,WorldToViewportPoint,ViewportToWorldPoint的運用,實現一個簡單的對三維中物體的拖拽移動效果   衆所周知,我們手機或者手機屏幕上的座標是一個二維平面的的座