麻豆黑色丝袜jk制服福利网站-麻豆精品传媒视频观看-麻豆精品传媒一二三区在线视频-麻豆精选传媒4区2021-在线视频99-在线视频a

千鋒教育-做有情懷、有良心、有品質(zhì)的職業(yè)教育機(jī)構(gòu)

手機(jī)站
千鋒教育

千鋒學(xué)習(xí)站 | 隨時(shí)隨地免費(fèi)學(xué)

千鋒教育

掃一掃進(jìn)入千鋒手機(jī)站

領(lǐng)取全套視頻
千鋒教育

關(guān)注千鋒學(xué)習(xí)站小程序
隨時(shí)隨地免費(fèi)學(xué)習(xí)課程

當(dāng)前位置:首頁  >  技術(shù)干貨  > unity學(xué)習(xí)筆記(一)

unity學(xué)習(xí)筆記(一)

來源:千鋒教育
發(fā)布人:qyf
時(shí)間: 2022-07-19 17:18:00 1658222280

  當(dāng)對一個(gè)父GameObject進(jìn)行無效設(shè)置后,它的子類gameobject也會(huì)無效,但是并沒有改變子類的狀態(tài),也就是說你沒有辦法使用它自身的屬性activeSelf,判斷一個(gè)子gameobject是否是激活狀態(tài),要使用activeInHierarchy。如果要改變子類的狀態(tài),使用DeactivateChildren

  使用transform的一些建議

  1,最好把它的父transforn的位置設(shè)置為(0,0,0)這樣對于它來說本地坐標(biāo)和世界坐標(biāo)是一樣的

  2,粒子系統(tǒng)的縮放不受transform的影響,需要去設(shè)置粒子發(fā)射器

  3,Rigidbody的縮放也不受transform影響,需要在Rigidbody組件上面設(shè)置

  4,修改父類的坐標(biāo)會(huì)影響子類的本坐標(biāo)

  旋轉(zhuǎn)的正確使用方法

  錯(cuò)誤一

  // rotation scripting mistake #1

  // the mistake here is that we are modifying the x value of a quaternion

  // this value does not represent an angle, and will not produce desired results

  void Update () {

  var rot = transform.rotation;

  rot.x += Time.deltaTime * 10;

  transform.rotation = rot;

  }

  錯(cuò)誤二

  // rotation scripting mistake #2

  // the mistake here is that we are reading, modifying then writing the Euler

  // values from a quaternion. Because these values calculated from a Quaternion,

  // each new rotation may return very different Euler angles, which may suffer from gimbal lock.

  void Update () {

  var angles = transform.rotation.eulerAngles;

  angles.x += Time.deltaTime * 10;

  transform.rotation = Quaternion.Euler(angles);

  }

  正確的方法

  // rotation scripting with Euler angles correctly.

  // here we store our Euler angle in a class variable, and only use it to

  // apply it as a Euler angle, but we never rely on reading the Euler back.

  float x;

  void Update () {

  x += Time.deltaTime * 10;

  transform.rotation = Quaternion.Euler(x,0,0);

  }

  unity的dll路徑

  mac:Applications/Unity/Unity.app/Contents/Frameworks/Managed/

  windows:C:\Program Files\Unity\Editor\Data\Managed

  加載AssetBundles的四種方式

  1,AssetBundle.LoadFromMemoryAsync

  IEnumerator LoadFromMemoryAsync(string path)

  {

  AssetBundleCreateRequest createRequest = AssetBundle.LoadFromMemoryAsync(File.ReadAllBytes(path));

  yield return createRequest;

  AssetBundle bundle = createRequest.assetBundle;

  var prefab = bundle.LoadAsset.("MyObject");

  Instantiate(prefab);

  }

  這種方式是異步加載一組包含AssetBundle 數(shù)據(jù)的byte數(shù)組到內(nèi)存中,可以添加CRC校驗(yàn),如果使用了LZMA壓縮,會(huì)自動(dòng)解壓

  2,AssetBundle.LoadFromFile

  public class LoadFromFileExample extends MonoBehaviour {

  function Start() {

  var myLoadedAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath, "myassetBundle"));

  if (myLoadedAssetBundle == null) {

  Debug.Log("Failed to load AssetBundle!");

  return;

  }

  var prefab = myLoadedAssetBundle.LoadAsset.("MyObject");

  Instantiate(prefab);

  }

  }

  Note: On Android devices with Unity 5.3 or older, this API will fail when trying to load AssetBundles from the Streaming Assets path. This is because the contents of that path will reside inside a compressed .jar file. Unity 5.4 and newer can use this API call with Streaming Assets just fine

  3,WWW.LoadFromCacheOrDownload

  using UnityEngine;

  using System.Collections;

  public class LoadFromCacheOrDownloadExample : MonoBehaviour

  {

  IEnumerator Start ()

  {

  while (!Caching.ready)

  yield return null;

  var www = WWW.LoadFromCacheOrDownload("http://myserver.com/myassetBundle", 5);

  yield return www;

  if(!string.IsNullOrEmpty(www.error))

  {

  Debug.Log(www.error);

  yield return;

  }

  var myLoadedAssetBundle = www.assetBundle;

  var asset = myLoadedAssetBundle.mainAsset;

  }

  }

  4,UnityWebRequest

  The UnityWebRequest has a specific API call to deal with AssetBundles. To begin, you’ll need to create your web request using UnityWebRequest.GetAssetBundle. After returning the request, pass the request object into DownloadHandlerAssetBundle.GetContent(UnityWebRequest). This GetContent call will return your AssetBundle object.

  You can also use the assetBundle property on the DownloadHandlerAssetBundle class after downloading the bundle to load the AssetBundle with the efficiency of AssetBundle.LoadFromFile.

  Here’s an example of how to load an AssetBundle that contains two GameObjects and Instantiate them. To begin this process, we’d just need to call StartCoroutine(InstantiateObject());

  IEnumerator InstantiateObject()

  {

  string uri = "file:///" + Application.dataPath + "/AssetBundles/" + assetBundleName; UnityEngine.Networking.UnityWebRequest request = UnityEngine.Networking.UnityWebRequest.GetAssetBundle(uri, 0);

  yield return request.Send();

  AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(request);

  GameObject cube = bundle.LoadAsset("Cube");

  GameObject sprite = bundle.LoadAsset("Sprite");

  Instantiate(cube);

  Instantiate(sprite);

  }

  打包之后查看各個(gè)資源的大小日志

  This information is available in the Editor Log just after you have performed the build. Go to the Console window (menu: Window < Console), click the small drop-down panel in the top right, and select Open Editor Log.

  在unity中減少圖片的像素

  try to reduce the physical size (in pixels) of the Texture images. To do this without modifying the actual source content, select the Texture in the Project view, and in the Inspector window reduce the Max Size. To see how this looks in-game, zoom in on a GameObject that uses the Texture, then adjust the Max Size until it starts looking worse in the Scene view. Changing the maximum Texture size does not affect your Texture Asset, just its resolution in the game.

  By default, Unity compresses all Textures when importing. For faster workflow in the Editor, go to Unity < Preferences and untick the checkbox for Compress Assets on Import. All Textures are compressed in the build, regardless of this setting.

1

  更多關(guān)于“unity培訓(xùn)”的問題,歡迎咨詢千鋒教育在線名師。千鋒教育多年辦學(xué),課程大綱緊跟企業(yè)需求,更科學(xué)更嚴(yán)謹(jǐn),每年培養(yǎng)泛IT人才近2萬人。不論你是零基礎(chǔ)還是想提升,都可以找到適合的班型,千鋒教育隨時(shí)歡迎你來試聽。

tags:
聲明:本站稿件版權(quán)均屬千鋒教育所有,未經(jīng)許可不得擅自轉(zhuǎn)載。
10年以上業(yè)內(nèi)強(qiáng)師集結(jié),手把手帶你蛻變精英
請您保持通訊暢通,專屬學(xué)習(xí)老師24小時(shí)內(nèi)將與您1V1溝通
免費(fèi)領(lǐng)取
今日已有369人領(lǐng)取成功
劉同學(xué) 138****2860 剛剛成功領(lǐng)取
王同學(xué) 131****2015 剛剛成功領(lǐng)取
張同學(xué) 133****4652 剛剛成功領(lǐng)取
李同學(xué) 135****8607 剛剛成功領(lǐng)取
楊同學(xué) 132****5667 剛剛成功領(lǐng)取
岳同學(xué) 134****6652 剛剛成功領(lǐng)取
梁同學(xué) 157****2950 剛剛成功領(lǐng)取
劉同學(xué) 189****1015 剛剛成功領(lǐng)取
張同學(xué) 155****4678 剛剛成功領(lǐng)取
鄒同學(xué) 139****2907 剛剛成功領(lǐng)取
董同學(xué) 138****2867 剛剛成功領(lǐng)取
周同學(xué) 136****3602 剛剛成功領(lǐng)取
相關(guān)推薦HOT
什么是PlatformIo?

PlatformIO是什么PlatformIO是一個(gè)全面的物聯(lián)網(wǎng)開發(fā)平臺,它為眾多硬件平臺和開發(fā)環(huán)境提供了統(tǒng)一的工作流程,有效簡化了開發(fā)過程,并能兼容各種...詳情>>

2023-10-14 12:55:06
云快照與自動(dòng)備份有什么區(qū)別?

1、定義和目標(biāo)不同云快照的主要目標(biāo)是提供一種快速恢復(fù)數(shù)據(jù)的方法,它只記錄在快照時(shí)間點(diǎn)后的數(shù)據(jù)變化,而不是所有的數(shù)據(jù)。自動(dòng)備份的主要目標(biāo)...詳情>>

2023-10-14 12:48:59
服務(wù)器為什么要用Linux?

服務(wù)器為什么要用Linux作為服務(wù)器操作系統(tǒng)的優(yōu)選,Linux在眾多選擇中脫穎而出。Linux作為服務(wù)器操作系統(tǒng)的優(yōu)選,有其獨(dú)特的優(yōu)勢和特點(diǎn)。包括其...詳情>>

2023-10-14 12:34:11
ORM解決的主要問題是什么?

ORM(對象關(guān)系映射)解決的主要問題是將關(guān)系數(shù)據(jù)庫與面向?qū)ο缶幊讨g的映射困境。在傳統(tǒng)的關(guān)系數(shù)據(jù)庫中,數(shù)據(jù)以表格的形式存儲,而在面向?qū)ο?..詳情>>

2023-10-14 12:26:19
Go為什么不支持三元運(yùn)算符?

Go為什么不支持三元運(yùn)算符Go語言是一種以簡潔和有效性為目標(biāo)的編程語言,因此在設(shè)計(jì)過程中,Go的設(shè)計(jì)者刻意排除了一些他們認(rèn)為可能導(dǎo)致復(fù)雜性或...詳情>>

2023-10-14 12:12:36
主站蜘蛛池模板: 2021国产麻豆剧果冻传媒入口| 欧美aaaaaaaa| 2021光根影院理论片| 国产人妖网站| 经典三级四虎在线观看 | av成人在线电影| 老少交欧美另类| 欧美ol丝袜高跟秘书在线播放| 美女扒开小内裤| 爱我久久国产精品| 四虎永久在线精品国产馆v视影院| 亚洲一区二区三区在线| 陪读妇乱子伦小说| 小蝌蚪视频在线观看www| 夜夜躁狠狠躁日日躁视频| 国产精品99| 日本肥熟| 高岭家の二轮花未增删| 91福利视频网| 欧美大香线蕉线伊人久久| 国产免费久久精品99久久| 色丁香影院| 在线免费福利| 94久久国产乱子伦精品免费| 色老太bbw| 喝乖女的奶水h1v| 三级黄色片在线观看| 91精品国产高清久久久久| 欧美中文字幕无线码视频| 国产韩国精品一区二区三区| 男生吃女生的jiojio| 亚洲性色高清完整版在线观看| 国产成人免费网站| 拔播拔播华人永久免费| 特区爱奴在线观看| 久久久噜噜噜久久中文字幕色伊伊 | 大胸妈妈的朋友| 日本一品道门免费高清视频| 亚洲日产欧| 大美香蕉伊在看欧美| 俺也去在线观看视频|