麻豆黑色丝袜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
主站蜘蛛池模板: 日本一本高清视频| 伊人久久大香线蕉久久婷婷| 男男高h粗暴黄车文| 亚洲欧美日韩综合在线播放| 国产精品无码久久综合网| 亚洲欧美日韩在线一区| 天天看免费高清影视| 国产一区美女视频| 粗大的内捧猛烈进出小视频| 欧美69影院| 精品国产www| 美女脱下裤子让男人捅| 在线观看中文字幕码| 老色哥| 波多野结衣porn| 国产区精品一区二区不卡中文| 极品丝袜乱系列在线阅读| 免费视频88av在线| 出租房换爱交换乱第二部| 果冻传媒和精东影业在线观看| 国产精品视频第一区二区三区| 亚洲无人区视频大全| 久久国产免费观看精品3| 欧美一线视频| 女人是男人的未来1分29分| 天天狠狠弄夜夜狠狠躁·太爽了| 亚洲国产美女精品久久久久| 一级毛片成人免费看免费不卡| 男朋友想吻我腿中间那个部位| 2018中文字幕第一页| 四虎永久网址在线观看| 波多野结衣无内裤护士| 爱情岛亚洲论坛在线观看| 欧美成人怡红院在线观看| 又粗又硬又黄又爽的免费视频| 日本免费观看网站| 老司机午夜在线视频免费| 黄a大片av永久免费| 大胸年轻的搜子4理论| 韩国男女无遮挡高清性视频| 国产真乱全集mangent|