Unity學習筆記
記錄學習過程中一些零散的Unity知識點
1 . 螢幕座標轉世界座標
Vector3 screenPos = new Vector3(Screen.width,0,0);
Vector3 moveWidth = Camera.main.ScreenToWorldPoint(screenPos);
2 . 獲取物體尺寸
GetComponent<Renderer>().bounds.extents;
相關推薦
Unity學習筆記—本地坐標轉世界坐標
oid click unit game 希望 項目 坐標 解決 -s 先簡單介紹一下我是一個程序員(菜鳥程序員),用C#開發,在開發的過程中會遇到一些問題,當時解決了但是在遇到可能還會在犯,所以啟發我做這樣一個學習筆記系列,一來是希望能夠督促自己總結學習,二來是可以在變身之
Unity學習筆記002.獲取Json某節點的值
Unity學習筆記002.獲取Json支付某節點的值 public static string GetJsonValue(string jsonStr, string key) { string result = string.Empty; if (!strin
Unity學習筆記001.協程獲取Token
Unity學習筆記001.協程獲取Token 呼叫方法1 呼叫方法2 IEnumerator GetAccessToken() { string url = string.Format("https://openapi.baidu.c
Unity學習筆記005.射線點選事件(PC/Mobile)
預處理,判斷當前平臺 void LateUpdate() { #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN PC(); #endif #IF UNITY_EDITOR || UNITY_ANDROID Mobile(); #endif
Unity學習筆記003.遞迴查詢子物體/獲取子物體元件
public static Transform FindChild(Transform parent,string name) { Transform child = null; child = parent.Find(name); if (child != null)
Unity學習筆記(二) 碰撞檢測與觸發檢測
正好看到了Roll a ball這個遊戲,於是就溫故一下碰撞檢測和觸發檢測 1.前期準備 中間省去建造一些基礎的物體的過程,最後呈現如下圖 我們的主角就是中間的球體 其GameObject名為player,我們在其身上添上剛體元件(Rigidbod
Unity學習筆記
記錄學習過程中一些零散的Unity知識點 1 . 螢幕座標轉世界座標 Vector3 screenPos = new Vector3(Screen.width,0,0); Vect
Unity學習筆記1 簡易2D橫版RPG遊戲製作(一)
這個教程是參考一個YouTube上面的教程做的,原作者的教程做得比較簡單,我先參考著做一遍,畢竟我也只是個初學者,還沒辦法完全自制哈哈。不過我之前也看過一個2D平臺遊戲的系列教程了,以後會整合起來,做出一個類似冒險島那樣的遊戲。 原視訊連結:點選開啟連結 這是個YouT
Unity學習筆記10——旋轉(四元數和尤拉角)
在Unity中,所有物體即使是空物體,也至少繫結Transform這個元件,這個元件有三個屬性:position、rotation、scale,它們分別用於控制物體的平移、旋轉和縮放三
Unity學習筆記2 簡易2D橫版RPG遊戲製作(二)
十二、敵人受攻擊時的閃爍和Player的生命值的修正 上一篇中,我們利用Controller2D中的IEnumerator TakenDamage介面,使得我們的Player受到攻擊時會進行閃爍,我們同樣地也希望在我們的敵人身上可以實現相同的效果。所以我們現在需要複製Con
【lupeng的部落格】unity學習筆記
個人簡介及聯絡方式 我是一個場景美術師,大學所學專業是電腦科學與技術,但是在遊戲行業從事場景美術工作已有8年的經驗,最近兩年開始接觸shader編寫,對遊戲開發的流程也有比較深入的瞭解,喜歡研究各種美術流程方面的知識,包括各種遊戲美術的優化等,目前從事技術美術的工作。歡
Unity學習筆記009.觸控控制(PC&Android)
目錄 1. AroundCameraMobile 2. AroundCameraPC 3. 呼叫方法 1. AroundCameraMobile using Developer.CameraExtension; using Unit
Unity學習筆記007.動態載入和銷燬Prefabs
參考: Unity學習筆記(5):動態載入Prefab:link Unity中例項化遊戲物體和銷燬遊戲物體:link Unity3d在指令碼中銷燬預設體時遇到的問題:link The name `AssetDatabase’ does not exist i
Unity學習筆記007.Unity接入原生Android百度AR地圖
大概操作步驟按筆記006執行。 1.背景 環境: OS:Windows10 Android Studio3.2 Unity 2018.1.2f1 思路 Unity端:主調方,UI Android端:底層介面,打包aar方式 2.步驟 2.1 Android S
【Unity學習筆記】Unity設定單位長度與畫素間的對應關係
在製作Roguelike遊戲時,需要隨機生成tiled地圖,此時需要將Unity的一個單位與Sprite的畫素相對應,方法如下: 1、單擊資原始檔夾下的Sprite; 2、在Inspector下的Pixel Per Unit屬性下填入一單位長度所對應的畫素數。
unity學習筆記01--基礎檢視以及基本操作
主要學習目標: 1、瞭解軟體的基本佈局以及使用 2、熟悉基本的操作快捷鍵 3、建立一個工程 4、建立一個cube和地板plane 5、建立複製一個cube 6、對cube進行移動,縮放 7、新增一個直光源 8、建立一個粒子 一、unity軟體基本介面介紹 工具欄,選單欄,以
Unity學習筆記 之 觸發Unity UI 的 Button 事件 的程式碼記錄
首先奉獻上 Button 所觸發的事件 的指令碼程式碼。 檔名為testButtonEvent using UnityEngine; using System.Collections; //1.引入 UI 。 using UnityEngine.UI; public
Unity學習筆記(元件篇1) Unity AudioSource元件的擴充套件使用
* 建立AudioClip檔案 ( 已知聲音取樣檔案 )* short[] data = null; // 這個是取樣資料可以從本地錄音也可以從網路下載 這裡設定為null AudioClip ac = AudioClip.Create
Unity學習筆記(3)-----製作一個模擬星系(複雜版)【Step1】
繼續學習Unity3D 這周任務之一是要做一個太陽系,如下圖: 而這次筆記的重點不在作業上~.~, 而是在於如何建立一個, 真正意義上的 “星系”。 上過課都知道, 作業簡單用以下兩條語句即可搞定: Planet.gameObject.transform.Rotat
unity學習筆記-精靈集和精靈動畫
2D遊戲中,對精靈的操作需求,往往是兩點: 1、 靜態精靈:一般做背景展示等 2、 精靈動畫:幀動畫、骨骼動畫等 宣告:以下對Unity的操作,基於Unity3D 4.3.4,本人初學Unity,沒用過其他版本。 一、 精靈檔案的匯入 方法1: 如果工程