原创 LayerMask 探究

1.在Unity中,直接輸出某個層layer的值會發現值並不是層的索引值。 print(layer.value); 輸出爲2的索引值次冪。 換一種寫法 print("NameToLayer=" + LayerMask.NameToLaye

原创 HttpWebResquest的用法

unity 內置的訪問Http的類  HttpWebRequest。使用起來很方便,簡單的示例如下: using UnityEngine; using System.Net; using System.IO; using System;

原创 unity 裏用代碼控制增加後者刪除標籤Tag和層Layer

 通過unityEditor 類可以實現將命令掛在菜單欄當中,用於自動創建Tag和layer. using System; using System.Collections; using System.Reflection; using

原创 HttpWebRequest 下載文件,並且能夠斷點續傳

  HttpWebRequest是unity 內置得類用來處理關於http通訊得。   using UnityEngine; using System.Threading; using System.IO; using System.

原创 Properties 反射的用法

 直接展示簡單的示例代碼。  using UnityEngine; using System.Collections; using System; using System.Reflection; public class GetPr

原创 c# 委託的簡單用法

委託的簡單實用方式,代碼格式如下。 using UnityEngine; using System.Collections; using System; public class DelegateTry : MonoBehaviour

原创 unityEvent 含參數的使用

unity 內置的事件,unityevent 的 使用。最多使用四個參數。且參數類型有限制,只能使用簡單的Bool值,int值,string等類型,不支持自定義類的作爲形參。 using UnityEngine; using Syste

原创 unity 網格編輯

用代碼直接創建unity mesh 網格。 示例爲可以不斷拉長的曲形的面片。網格完成後會進行平滑插值,讓曲形更加平滑。  using System.Collections; using System.Collections.Generi

原创 unity 按鍵鍵值檢測。

using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; pu

原创 c# Json的簡單使用方式。

Json 能夠直接與類進行互轉。在做數據通訊的時候,能夠很方便的進行數據傳遞,然後解析出來使用。  using UnityEngine; using System.Collections; using System.Collection

原创 LineRenderer 簡單畫線

 通過unity內置的LineRenderer 繪製線條。 using System.Collections; using System.Collections.Generic; using UnityEngine; using Uni

原创 Ragdoll 自動配置

 人物骨骼的引用綁定,如果是要一個個手動設置,大概是相當讓人頭痛的事情吧。 using UnityEngine; using System.Collections; using UnityEditor; using System.Ref

原创 c# ref 的使用。

1.ref 的使用。 void Function(ref p) 使用ref 傳參,是傳遞的地址。 public class RefTest : MonoBehaviour { string p; void Start () { p = "

原创 Vector3.Slerp的使用

1.Vector3.Slerp是指球形插值。官網用法如下 //在日出和日落之間動畫弧線   usingUnityEngine;   usingSystem.Collections;       publicclass example :

原创 ref 的使用。

1.ref 的使用。 void Function(ref p) 使用ref 傳參,是傳遞的地址。 public class RefTest : MonoBehaviour { string p; // Use this for init