乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Overview: Accessing Other Components 概述:訪問其他組件

       有趣的永 2015-12-24

      Overview: Accessing Other Components 訪問其他組件

      Components are attached to game objects. Attaching a Renderer component to a game object is what makes it render on the screen, attaching a Camera turns it into a camera object. All scripts are components thus they can be attached to game objects.

      組件附屬于游戲物體.把一個 Renderer (渲染器)組件附到游戲對象,可以使游戲對象顯示到場景,附一個 Camera (攝像機)可以把物體變成一個攝像機物體.所有腳本都是組件,因此都能附到游戲對象上.

      The most common components are accessible as simple member variables:

      常用的組件可以通過簡單的成員變量取得:

      Component	Accessible as
      Transform	         transform
      Rigidbody	         rigidbody
      Renderer	         renderer
      Camera	         camera (only on camera objects)
      Light	                 light (only on light objects)
      Animation	         animation
      Collider	         collider
      ... etc.

      For the full list of predefined member variables see the documentation for the Component , Behaviour and MonoBehaviour classes. If the game object does not have a component of the type you wish to fetch, the above variables will be set to null.

      要看所有的預定義成員變量,請查看文檔 Component , Behaviour MonoBehaviour 類.如果游戲對象中沒有你想要取得的組件類型,上面的變量值將為null.

      Any component or script attached to a game object can be accessed through GetComponent.

      附在游戲對象上的組件或腳本可以通過GetComponent獲取.

      transform.Translate(0, 1, 0);
      // is equivalent to //相當于
      GetComponent(Transform).Translate(0, 1, 0);

      Note the case difference between transform and Transform . The former is a variable (lower case), the latter is a class or script name (upper case). This case difference lets you to differentiate variables from class&script names.

      注意transform 和 Transform 的差異.前面是一個變量(小寫),后面是一個類或腳本名稱(大寫).這個不同之處可以讓你區(qū)分變量,類和腳本名稱.

      Applying what we have learned, we can now find any script or builtin component which is attached to the same game object using GetComponent . Please note that to make the following example work you need to have a script called OtherScript containing a function DoSomething. The OtherScript script must be attached to the same game object as the following script.

      應用我們學到的,我們現在能使用 GetComponent 找到附在游戲對象上的腳本或已有的組件.請注意下面的例子,假設你要調用一個名叫OtherScript的腳本,它包含有一個函數DoSomething. OtherScript腳本要附于下面腳本所在的同一游戲對象上.

      // This finds the script called OtherScript in the same game object
      // 這個獲得同一個物體上的OtherScript腳本
      // and calls DoSomething on it.
      // 訪問他的 DoSomething .
      function Update () 
      {
          otherScript = GetComponent (OtherScript);
          otherScript.DoSomething();
      }
      
      
      最后修改:2011年5月16日 Monday 21:49

        本站是提供個人知識管理的網絡存儲空間,所有內容均由用戶發(fā)布,不代表本站觀點。請注意甄別內容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現有害或侵權內容,請點擊一鍵舉報。
        轉藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多