{"id":50877,"date":"2025-08-10T13:34:59","date_gmt":"2025-08-10T05:34:59","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/50877.html"},"modified":"2025-08-10T13:34:59","modified_gmt":"2025-08-10T05:34:59","slug":"unity%e7%ac%94%e8%ae%b0%e5%9b%9b-camera%e3%80%81%e7%a2%b0%e6%92%9e%e6%a3%80%e6%b5%8b%e5%87%bd%e6%95%b0%e3%80%81%e5%88%9a%e4%bd%93%e5%8a%a0%e5%8a%9b%e3%80%81%e9%9f%b3%e9%a2%91","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/50877.html","title":{"rendered":"Unity\u7b14\u8bb0(\u56db)\u2014\u2014Camera\u3001\u78b0\u649e\u68c0\u6d4b\u51fd\u6570\u3001\u521a\u4f53\u52a0\u529b\u3001\u97f3\u9891"},"content":{"rendered":"<h2>\u5199\u5728\u524d\u9762&#xff1a;<\/h2>\n<p>\u5199\u672c\u7cfb\u5217(\u81ea\u7528)\u7684\u76ee\u7684\u662f\u56de\u987e\u5df2\u7ecf\u5b66\u8fc7\u7684\u77e5\u8bc6\u3001\u8bb0\u5f55\u65b0\u5b66\u4e60\u7684\u77e5\u8bc6\u6216\u662f\u8bb0\u5f55\u5fc3\u5f97\u7406\u89e3&#xff0c;\u65b9\u4fbf\u81ea\u5df1\u4ee5\u540e\u5feb\u901f\u590d\u4e60&#xff0c;\u51cf\u5c11\u9057\u5fd8\u3002\u4e3b\u8981\u662fC#\u4ee3\u7801\u90e8\u5206\u3002<\/p>\n<\/p>\n<h2>\u5341\u4e09\u3001Camera<\/h2>\n<h3>1\u3001\u91cd\u8981\u9759\u6001\u6210\u5458<\/h3>\n<h4>(1)\u83b7\u53d6\u6444\u50cf\u673a<\/h4>\n<p>\u83b7\u53d6\u4e3b\u6444\u50cf\u673a\u4f7f\u7528&#xff1a;Camera.main&#xff0c;\u8981\u6ce8\u610f\u83b7\u53d6\u4e3b\u6444\u50cf\u673a\u65f6&#xff0c;\u573a\u666f\u4e2d\u4e00\u5b9a\u81f3\u5c11\u8981\u6709\u4e00\u4e2a\u6444\u50cf\u673atag\u4e3aMainCamera\u3002\u5982\u679c\u6709\u591a\u4e2a\u4e3b\u6444\u50cf\u673a&#xff0c;\u4f1a\u968f\u673a\u8fd4\u56de\u4e00\u4e2a\u3002<\/p>\n<p>\u83b7\u53d6\u5f53\u524d\u573a\u666f\u4e2d\u6444\u50cf\u673a\u7684\u4e2a\u6570&#xff1a;Camera.allCamerasCount<\/p>\n<p>\u83b7\u53d6\u6240\u6709\u7684\u6444\u50cf\u673a&#xff1a;Camera.allCameras<\/p>\n<p>void Start()<br \/>\n{<br \/>\n    print(Camera.main.name);<\/p>\n<p>    print(Camera.allCamerasCount);<\/p>\n<p>    Camera[] allCamera &#061;  Camera.allCameras;<br \/>\n    print(allCamera.Length);<br \/>\n}<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"119\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053456-68982f806edcf.png\" width=\"302\" \/><\/p>\n<h4>(2)\u6e32\u67d3\u76f8\u5173\u59d4\u6258<\/h4>\n<p>\u76ee\u524d\u8fd9\u91cc\u4ec5\u505a\u4e86\u89e3&#xff0c;\u77e5\u9053\u6709\u8fd9\u51e0\u4e2a\u51fd\u6570&#xff0c;\u540e\u7eed\u7528\u5230\u518d\u5b66<\/p>\n<p>Camera.onPreCull&#xff0c;\u6444\u50cf\u673a\u5254\u9664\u524d\u5904\u7406\u7684\u59d4\u6258\u51fd\u6570<\/p>\n<p>Camera.onPreRender&#xff0c;\u6444\u50cf\u673a\u6e32\u67d3\u524d\u5904\u7406\u7684\u59d4\u6258<\/p>\n<p>Camera.onPostRender&#xff0c;\u6444\u50cf\u673a\u6e32\u67d3\u540e\u5904\u7406\u7684\u59d4\u6258<\/p>\n<p>\u642d\u914d\u533f\u540d\u51fd\u6570\u4f7f\u7528<\/p>\n<p>void Start()<br \/>\n{<br \/>\n    Camera.onPreCull &#043;&#061; (c) &#061;&gt;<br \/>\n    {<\/p>\n<p>    };<\/p>\n<p>    Camera.onPreRender &#043;&#061; (c) &#061;&gt;<br \/>\n    {<\/p>\n<p>    };<\/p>\n<p>    Camera.onPostRender -&#061; (c) &#061;&gt;<br \/>\n    {<\/p>\n<p>    };<br \/>\n}<\/p>\n<h3>2\u3001\u91cd\u8981\u6210\u5458<\/h3>\n<h4>(1)Inspector\u4e0a\u7684\u53c2\u6570<\/h4>\n<p>Inspector\u9762\u677f\u4e0a\u7684\u53c2\u6570\u90fd\u53ef\u4ee5\u901a\u8fc7Camera\u83b7\u5f97\u5e76\u4fee\u6539&#xff1a;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"524\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053456-68982f8086a8e.png\" width=\"349\" \/><\/p>\n<p>\u4f8b\u5982&#xff0c;\u83b7\u53d6\u5e76\u4fee\u6539\u53c2\u6570Depth&#xff1a;<\/p>\n<p>Camera.main.depth &#061; 10;<\/p>\n<h4>(2)\u4e16\u754c(\u573a\u666f)\u5750\u6807\u8f6c\u4e3a\u5c4f\u5e55\u5750\u6807<\/h4>\n<p>\u5176\u4e2d&#xff0c;\u5c4f\u5e55\u5750\u6807\u7684x\u3001y\u5206\u522b\u8868\u793a\u7684\u662f\u8be5\u70b9(\u573a\u666f\u4e0a\u7684\u70b9)\u5728\u5c4f\u5e55\u4e0a\u7684\u5750\u6807&#xff0c;\u800cz\u8f74\u8868\u793a3D\u7269\u7406\u79bb\u6444\u50cf\u673a\u6709\u591a\u8fdc\u3002\u4f7f\u7528\u7684\u51fd\u6570\u662fCamera.main.WorldToScreenPoint()<\/p>\n<p>void Start()<br \/>\n{<br \/>\n    Vector3 v &#061;  Camera.main.WorldToScreenPoint(this.transform.position);<br \/>\n    print(v);<br \/>\n}<\/p>\n<p>\u56fe\u7247\u4e0a\u534a\u90e8\u5206\u662f\u573a\u666f&#xff0c;\u4e0b\u534a\u90e8\u5206\u662f\u5c4f\u5e55<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"369\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053456-68982f809c08b.png\" width=\"324\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"70\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053457-68982f814af4e.png\" width=\"450\" \/><\/p>\n<h4>(3)\u5c4f\u5e55\u5750\u6807\u8f6c\u4e3a\u4e16\u754c\u5750\u6807<\/h4>\n<p>\u53ef\u4ee5\u6355\u6349\u9f20\u6807\u5728\u5c4f\u5e55\u4e0a\u7684\u5750\u6807&#xff0c;\u7136\u540e\u5c06\u5176\u8f6c\u6362\u4e3a\u573a\u666f\u5750\u6807&#xff0c;\u8fd9\u6837\u53ef\u4ee5\u5b9e\u73b0\u901a\u8fc7\u9f20\u6807\u63a7\u5236\u573a\u666f\u4e0a\u7684\u7269\u4f53&#xff0c;\u4f7f\u7528\u7684\u51fd\u6570\u662f&#xff1a;Camera.main.ScreenToWorldPoint()<\/p>\n<p>   public GameObject obj;<br \/>\n    void Update()<br \/>\n    {<br \/>\n        Vector3 v &#061; Input.mousePosition;<br \/>\n        v.z &#061; 10;<br \/>\n        obj.transform.position &#061; Camera.main.ScreenToWorldPoint(v);<br \/>\n    }<\/p>\n<p>\u8fd9\u91cc\u89e3\u91ca\u4e00\u4e0b\u4e3a\u4ec0\u4e48\u8981\u5c06\u9f20\u6807\u7684z\u8f74\u5750\u6807\u8bbe\u7f6e\u4e3a10\u3002\u4e0a\u6587\u63d0\u5230&#xff0c;\u5728\u5c4f\u5e55\u4e0a\u7684\u5750\u6807&#xff0c;z\u8f74\u8868\u793a3D\u7269\u7406\u79bb\u6444\u50cf\u673a\u6709\u591a\u8fdc\u3002\u9f20\u6807\u7684z\u8f74\u9ed8\u8ba4\u4e3a0&#xff0c;\u5047\u5982\u4e0d\u66f4\u6539\u9f20\u6807\u7684z\u8f74&#xff0c;\u5c31\u4f1a\u5bfc\u81f4\u9f20\u6807\u5750\u6807\u8f6c\u6362\u4e3a\u573a\u666f\u5750\u6807\u65f6&#xff0c;\u79bb\u6444\u50cf\u673a\u7684\u8ddd\u79bb\u4e3a0\u3002\u6ee1\u8db3\u79bb\u6444\u50cf\u673a\u8ddd\u79bb\u4e3a0\u7684\u70b9\u53ea\u67091\u4e2a&#xff0c;\u5373\u6444\u50cf\u673a\u672c\u8eab\u7684\u5750\u6807\u3002\u8fd9\u6837\u65e0\u8bba\u4f60\u600e\u4e48\u52a8&#xff0c;\u5f97\u5230\u7684\u573a\u666f\u5750\u6807\u90fd\u4e0d\u4f1a\u53d8\u3002<\/p>\n<p>z\u8f74\u53ef\u4ee5\u8bbe\u7f6e\u4e3a\u4efb\u610f\u975e0\u503c&#xff0c;\u8f6c\u6362\u540e\u7684z\u8f74\u5750\u6807\u4fdd\u6301\u4e3a\u8fd9\u4e2a\u56fa\u5b9a\u503c\u4e0d\u53d8\u3002\u770b\u8d77\u6765\u7684\u6548\u679c\u662f\u65e0\u8bba\u9f20\u6807\u600e\u4e48\u79fb\u52a8&#xff0c;\u5728\u573a\u666f\u4e0a\u90fd\u662f\u5728\u4e00\u4e2ax\u3001y\u5e73\u9762\u4e0a\u79fb\u52a8\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"316\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053457-68982f8153ea7.png\" width=\"307\" \/><\/p>\n<\/p>\n<h2>\u5341\u56db\u3001\u78b0\u649e\u68c0\u6d4b\u51fd\u6570<\/h2>\n<h3>1\u3001\u7269\u7406\u78b0\u649e\u68c0\u6d4b\u54cd\u5e94\u51fd\u6570<\/h3>\n<p>\u78b0\u649e\u68c0\u6d4b\u54cd\u5e94\u51fd\u6570\u6709\u4e09\u4e2a&#xff0c;\u5b83\u4eec\u4e5f\u662f\u4e00\u79cd\u7279\u6b8a\u7684\u751f\u547d\u5468\u671f\u51fd\u6570&#xff1a;<\/p>\n<p>private void OnCollisionEnter(Collision collision)&#xff1a;\u78b0\u649e\u89e6\u53d1\u63a5\u89e6\u65f6&#xff0c;\u4f1a\u81ea\u52a8\u6267\u884c<\/p>\n<p>private void OnCollisionExit(Collision collision)&#xff1a;\u78b0\u649e\u7ed3\u675f\u5206\u79bb\u65f6&#xff0c;\u4f1a\u81ea\u52a8\u6267\u884c<\/p>\n<p>private void OnCollisionStay(Collision collision)&#xff1a;\u4e24\u4e2a\u7269\u4f53\u76f8\u4e92\u63a5\u89e6\u6469\u64e6\u65f6&#xff0c;\u4f1a\u81ea\u52a8\u6267\u884c<\/p>\n<p>\u800c\u53c2\u6570\u5217\u8868\u4e2d&#xff0c;Collision\u7c7b\u578b\u7684\u53c2\u6570\u5305\u542b\u4e86\u78b0\u5230\u81ea\u5df1\u7684\u5bf9\u8c61\u7684\u76f8\u5173\u4fe1\u606f&#xff1a;<\/p>\n<p>1\u3001\u78b0\u649e\u5230\u7684\u5bf9\u8c61\u78b0\u649e\u5668\u7684\u4fe1\u606f<\/p>\n<p>collision.collider<\/p>\n<p>2\u3001\u78b0\u649e\u5bf9\u8c61\u7684\u4f9d\u9644\u5bf9\u8c61<\/p>\n<p>collision.gameObject<\/p>\n<p>3\u3001\u78b0\u649e\u5bf9\u8c61\u7684\u4f9d\u9644\u5bf9\u8c61\u7684\u4f4d\u7f6e\u4fe1\u606f<\/p>\n<p>collision.transform<\/p>\n<p>4\u3001\u78b0\u649e\u70b9\u6570\u76f8\u5173<\/p>\n<p>collision.contactCount<\/p>\n<p>\u63a5\u89e6\u70b9\u5177\u4f53\u7684\u5750\u6807&#xff1a;ContactPoint[] pos &#061; collision.contacts;<\/p>\n<p>\u53ea\u8981\u5f97\u5230\u4e86\u78b0\u649e\u5bf9\u8c61\u7684\u4efb\u610f\u4e00\u4e2a\u4fe1\u606f&#xff0c;\u5c31\u53ef\u4ee5\u5f97\u5230\u5b83\u7684\u6240\u6709\u4fe1\u606f<\/p>\n<p>    private void OnCollisionEnter(Collision collision)<br \/>\n    {<br \/>\n        print(this.name &#043; &#034;\u88ab&#034; &#043; collision.gameObject.name &#043; &#034;\u649e\u5230\u4e86&#034;);<br \/>\n    }<\/p>\n<p>    private void OnCollisionExit(Collision collision)<br \/>\n    {<br \/>\n        print(this.name &#043; &#034;\u88ab&#034; &#043; collision.gameObject.name &#043; &#034;\u7ed3\u675f\u78b0\u649e\u4e86&#034;);<br \/>\n    }<\/p>\n<p>    private void OnCollisionStay(Collision collision)<br \/>\n    {<br \/>\n        print(this.name &#043; &#034;\u4e00\u76f4\u5728\u548c&#034; &#043; collision.gameObject.name &#043; &#034;\u63a5\u89e6&#034;);<br \/>\n    }<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"286\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053457-68982f81a18cf.png\" width=\"351\" \/><\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"128\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053457-68982f81bfae3.png\" width=\"323\" \/><\/p>\n<h3>2\u3001\u89e6\u53d1\u5668\u68c0\u6d4b\u54cd\u5e94\u51fd\u6570<\/h3>\n<p>\u89e6\u53d1\u5668\u53ef\u4ee5\u6a21\u62df\u5b50\u5f39\u7a7f\u8fc7\u7269\u4f53&#xff0c;\u5b83\u548c\u7269\u4f53\u4f1a\u7ed3\u675f\u4f46\u662f\u4e0d\u4f1a\u4ea7\u751f\u78b0\u649e\u6548\u679c\u3002\u5728Inspector\u9762\u677f\u91cc\u52fe\u9009is Trigger\u5373\u53ef\u5c06\u7269\u4f53\u4f5c\u4e3a\u89e6\u53d1\u5668\u3002<\/p>\n<p>\u89e6\u53d1\u5668\u68c0\u6d4b\u54cd\u5e94\u51fd\u6570\u540c\u6837\u6709\u4e09\u4e2a&#xff1a;<\/p>\n<p>private void OnTriggerEnter(Collider other)&#xff1a;\u89e6\u53d1\u5668\u63a5\u89e6\u7269\u4f53\u65f6&#xff0c;\u4f1a\u81ea\u52a8\u6267\u884c<\/p>\n<p>private void OnTriggerExit(Collider other)&#xff1a;\u89e6\u53d1\u5668\u548c\u7269\u4f53\u5206\u5f00\u65f6&#xff0c;\u4f1a\u81ea\u52a8\u6267\u884c<\/p>\n<p>private void OnTriggerStay(Collider other)&#xff1a;\u89e6\u53d1\u5668\u548c\u7269\u4f53\u5728\u201c\u878d\u5408\u201d\u72b6\u6001\u65f6&#xff0c;\u4f1a\u81ea\u52a8\u6267\u884c&#xff0c;\u878d\u5408\u72b6\u6001\u5c31\u662f\u89e6\u53d1\u5668\u7a7f\u8fc7\u7269\u4f53\u65f6&#xff1a;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"162\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053457-68982f81d1045.png\" width=\"269\" \/><\/p>\n<p>private void OnTriggerEnter(Collider other)<br \/>\n{<br \/>\n    print(this.name &#043; &#034;\u88ab&#034; &#043; other.gameObject.name &#043; &#034;\u89e6\u53d1\u4e86&#034;);<br \/>\n}<\/p>\n<p>private void OnTriggerExit(Collider other)<br \/>\n{<br \/>\n    print(this.name &#043; &#034;\u548c&#034; &#043; other.gameObject.name &#043; &#034;\u7ed3\u675f\u63a5\u89e6\u4e86&#034;);<br \/>\n}<\/p>\n<p>private void OnTriggerStay(Collider other)<br \/>\n{<br \/>\n    print(this.name &#043; &#034;\u548c&#034; &#043; other.gameObject.name &#043; &#034;\u6b63\u5728\u878d\u5408\u72b6\u6001&#034;);<br \/>\n}<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"143\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053457-68982f81e8e57.png\" width=\"536\" \/><\/p>\n<p>\u53ea\u8981\u6302\u8f7d\u7684\u5bf9\u8c61\u80fd\u548c\u522b\u7684\u7269\u4f53\u4ea7\u751f\u78b0\u649e\u6216\u8005\u89e6\u53d1&#xff0c;\u90a3\u4e48\u4ee5\u4e0a\u76846\u4e2a\u51fd\u6570\u5c31\u80fd\u591f\u54cd\u5e94<\/p>\n<p>\u5982\u679c\u662f\u5f02\u5f62\u7269\u4f53&#xff0c;\u521a\u4f53\u5728\u7236\u5bf9\u8c61\u4e0a&#xff0c;\u5982\u679c\u60f3\u901a\u8fc7\u5b50\u5bf9\u8c61\u4e0a\u6302\u811a\u672c\u68c0\u6d4b\u78b0\u649e\u662f\u4e0d\u884c\u7684&#xff0c;\u5fc5\u987b\u8981\u6302\u8f7d\u7236\u5bf9\u8c61\u4e0a<\/p>\n<p>\u53e6\u5916&#xff0c;\u8bbf\u95ee\u4fee\u9970\u7b26\u4e0d\u4e00\u5b9a\u8981\u5199private&#xff0c;\u53ef\u4ee5\u5199protected&#xff0c;\u8fd9\u6837\u53ef\u4ee5\u628a\u51fd\u6570\u5199\u6210\u865a\u51fd\u6570\u5728\u5b50\u7c7b\u4e2d\u91cd\u5199\u3002\u800c\u5199\u6210public\u6ca1\u6709\u5fc5\u8981&#xff0c;\u56e0\u4e3a\u6211\u4eec\u4e00\u822c\u4e0d\u4f1a\u81ea\u5df1\u8c03\u7528\u8fd9\u51e0\u4e2a\u51fd\u6570&#xff0c;\u90fd\u662funity\u6765\u8c03\u7528<\/p>\n<\/p>\n<h2>\u5341\u4e94\u3001\u521a\u4f53\u52a0\u529b<\/h2>\n<h3>1\u3001\u521a\u4f53\u81ea\u5e26\u6dfb\u52a0\u529b\u7684\u65b9\u6cd5<\/h3>\n<p>\u5728\u5bf9\u521a\u4f53\u6dfb\u52a0\u529b\u4e4b\u524d&#xff0c;\u9700\u8981\u5148\u83b7\u53d6\u521a\u4f53\u7ec4\u4ef6&#xff1a;rigidbody &#061; GetComponent&lt;Rigidbody&gt;();<\/p>\n<h4>(1)\u6dfb\u52a0\u529b<\/h4>\n<p>\u6dfb\u52a0\u529b\u53ef\u4ee5\u5206\u522b\u76f8\u5bf9\u4e16\u754c\u5750\u6807\u3001\u76f8\u5bf9\u4e8e\u672c\u5730\u5750\u6807&#xff0c;\u5206\u522b\u7528&#xff1a;<\/p>\n<p>rigidbody.AddForce()\u3001rigidbody.AddRelativeForce()&#xff0c;\u62ec\u53f7\u91cc\u4f20\u5165\u6dfb\u52a0\u7684\u529b&#xff0c;\u529b\u5305\u542b\u529b\u7684\u65b9\u5411\u548c\u529b\u7684\u5927\u5c0f\u3002<\/p>\n<p>\u52a0\u529b\u540e&#xff0c;\u5bf9\u8c61\u662f\u5426\u505c\u6b62\u79fb\u52a8\u662f\u7531\u963b\u529b\u51b3\u5b9a\u7684&#xff0c;\u5982\u679c\u963b\u529b\u4e3a0&#xff0c;\u5a1c\u7ed9\u8fc7\u529b\u540e\u662f\u59cb\u7ec8\u4e0d\u4f1a\u505c\u6b62\u79fb\u52a8\u7684\u3002<\/p>\n<p>Rigidbody rigidbody;<br \/>\nvoid Start()<br \/>\n{<br \/>\n    rigidbody &#061; GetComponent&lt;Rigidbody&gt;();<\/p>\n<p>    \/\/\u76f8\u5bf9\u4e16\u754c\u5750\u6807<br \/>\n    rigidbody.AddForce(Vector3.forward * 10);<\/p>\n<p>    \/\/\u76f8\u5bf9\u672c\u5730\u5750\u6807<br \/>\n    rigidbody.AddRelativeForce(Vector3.forward * 10);<br \/>\n}<\/p>\n<h4>(2)\u6dfb\u52a0\u626d\u77e9\u529b&#xff0c;\u8ba9\u5176\u65cb\u8f6c<\/h4>\n<p>\u6dfb\u52a0\u626d\u77e9\u529b\u540c\u6837\u53ef\u4ee5\u5206\u522b\u76f8\u5bf9\u4e16\u754c\u5750\u6807\u3001\u76f8\u5bf9\u4e8e\u672c\u5730\u5750\u6807&#xff0c;\u5206\u522b\u7528&#xff1a;<\/p>\n<p>rigidbody.AddTorque()\u3001rigidbody.AddRelativeTorque()<\/p>\n<p>Rigidbody rigidbody;<br \/>\nvoid Start()<br \/>\n{<br \/>\n    rigidbody &#061; GetComponent&lt;Rigidbody&gt;();<\/p>\n<p>    rigidbody.AddTorque(Vector3.up * 10);<\/p>\n<p>    rigidbody.AddRelativeTorque(Vector3.up * 10);<br \/>\n}<\/p>\n<h4>(3)\u76f4\u63a5\u6539\u53d8\u901f\u5ea6<\/h4>\n<p>\u53ef\u4ee5\u4f7f\u7528rigidbody.velocity\u76f4\u63a5\u6539\u53d8\u901f\u5ea6\u3002\u8fd9\u4e2a\u901f\u5ea6\u65b9\u5411\u662f\u76f8\u5bf9\u4e8e\u4e16\u754c\u5750\u6807\u7cfb\u7684\u3002<\/p>\n<p>Rigidbody rigidbody;<br \/>\nvoid Start()<br \/>\n{<br \/>\n    \/\/\u76f4\u63a5\u6539\u53d8\u901f\u5ea6&#xff0c;\u901f\u5ea6\u65b9\u5411\u76f8\u5bf9\u4e8e\u4e16\u754c\u5750\u6807\u7cfb<br \/>\n    rigidbody.velocity &#061; Vector3.forward * 5;<br \/>\n}<\/p>\n<h4>(4)\u6a21\u62df\u7206\u70b8\u6548\u679c<\/h4>\n<p>\u6a21\u62df\u7206\u70b8\u6548\u679c\u91c7\u7528\u7684\u65b9\u6cd5\u662f&#xff1a;rigidbody.AddExplosionForce()&#xff0c;\u91cc\u9762\u6709\u4e09\u4e2a\u53c2\u6570&#xff0c;\u5206\u522b\u4f20\u5165\u529b\u7684\u5927\u5c0f\u3001\u7206\u70b8\u4e2d\u5fc3\u3001\u7206\u70b8\u534a\u5f84\u3002<\/p>\n<p>\u5047\u5982\u6a21\u62df\u7206\u70b8\u9700\u8981\u591a\u4e2a\u5bf9\u8c61&#xff0c;\u90a3\u4e48\u8fd9\u4e9b\u5bf9\u8c61\u90fd\u9700\u8981\u6dfb\u52a0\u521a\u4f53&#xff0c;\u5e76\u4e14\u6302\u8f7d\u8fd9\u4e2a\u811a\u672c&#xff0c;\u624d\u4f1a\u8fbe\u5230\u7206\u70b8\u7684\u6548\u679c\u3002<\/p>\n<p>Rigidbody rigidbody;<br \/>\nvoid Start()<br \/>\n{<br \/>\n    \/\/\u6a21\u62df\u7206\u70b8\u6548\u679c<br \/>\n    rigidbody.AddExplosionForce(10, Vector3.zero, 10);<br \/>\n}<\/p>\n<h3>2\u3001\u529b\u7684\u51e0\u79cd\u6a21\u5f0f<\/h3>\n<p>\u529b\u7684\u6a21\u5f0f\u4e3b\u8981\u7684\u4f5c\u7528\u5c31\u662f\u8ba1\u7b97\u65b9\u5f0f\u4e0d\u540c\u3002\u5171\u6709\u56db\u79cd\u65b9\u6cd5&#xff0c;\u56db\u79cd\u65b9\u6cd5\u8ba1\u7b97\u65b9\u5f0f\u7684\u4e0d\u540c&#xff0c;\u6700\u7ec8\u7684\u79fb\u52a8\u901f\u5ea6\u4e5f\u4f1a\u4e0d\u540c\u3002<\/p>\n<p>\u6211\u4eec\u77e5\u9053&#xff0c;\u7531\u52a8\u91cf\u5b9a\u7406&#xff1a;Ft &#061; mv\u3002\u5176\u4e2d&#xff0c;F\u662f\u529b&#xff0c;t\u662f\u65f6\u95f4&#xff0c;m\u662f\u8d28\u91cf&#xff0c;v\u662f\u901f\u5ea6\u3002\u90a3\u4e48 v &#061; Ft\/m\u3002<\/p>\n<h4>(1)Acceleration<\/h4>\n<p>\u5f53\u6dfb\u52a0\u529b&#xff0c;\u4f7f\u7528\u7684\u6a21\u5f0f\u662fAcceleration\u65f6&#xff1a;<\/p>\n<p>rigidbody.AddForce(Vector3.forward * 10, ForceMode.Acceleration);<\/p>\n<p>\u8fd9\u4e2a\u6a21\u5f0f\u4e0b\u529b\u4f1a\u7ed9\u7269\u4f53\u589e\u52a0\u4e00\u4e2a\u6301\u7eed\u7684\u52a0\u901f\u5ea6&#xff0c;\u5ffd\u7565\u5176\u8d28\u91cf\u3002\u5728\u8fd9\u4e2a\u4ee3\u7801\u4e0bF&#xff1a;(0, 0, 10)&#xff0c;t&#xff1a;0.02(\u9ed8\u8ba4\u7269\u7406\u5e27\u66f4\u65b0\u65f6\u95f4)\u3001m&#xff1a;\u9ed8\u8ba4\u4e3a1&#xff0c;\u90a3\u4e48\u6b64\u65f6\u7684v &#061; 0.2m\/s\u3002<\/p>\n<h4>(2)Force<\/h4>\n<p>\u5f53\u6dfb\u52a0\u529b&#xff0c;\u4f7f\u7528\u7684\u6a21\u5f0f\u662fForce\u65f6&#xff1a;<\/p>\n<p>rigidbody.AddForce(Vector3.forward * 10, ForceMode.Force);<\/p>\n<p>\u8fd9\u4e2a\u6a21\u5f0f\u4e0b\u529b\u4f1a\u7ed9\u7269\u4f53\u6dfb\u52a0\u4e00\u4e2a\u6301\u7eed\u7684\u529b&#xff0c;\u4e0e\u7269\u4f53\u7684\u8d28\u91cf\u6709\u5173\u3002\u5728\u8fd9\u4e2a\u4ee3\u7801\u4e0bF&#xff1a;(0, 0, 10)&#xff0c;t&#xff1a;0.02(\u9ed8\u8ba4\u7269\u7406\u5e27\u66f4\u65b0\u65f6\u95f4)\u3001m&#xff1a;2kg(\u5047\u8bbe\u4e3a2kg&#xff0c;\u53ef\u4ee5\u4fee\u6539)&#xff0c;\u90a3\u4e48\u6b64\u65f6\u7684v &#061; 0.1m\/s\u3002<\/p>\n<h4>(3)Impulse<\/h4>\n<p>\u5f53\u6dfb\u52a0\u529b&#xff0c;\u4f7f\u7528\u7684\u6a21\u5f0f\u662fImpulse\u65f6&#xff1a;<\/p>\n<p>rigidbody.AddForce(Vector3.forward * 10, ForceMode.Impulse);<\/p>\n<p>\u8fd9\u4e2a\u6a21\u5f0f\u4e0b\u529b\u4f1a\u7ed9\u7269\u4f53\u6dfb\u52a0\u4e00\u4e2a\u77ac\u95f4\u7684\u529b&#xff0c;\u4e0e\u7269\u4f53\u7684\u8d28\u91cf\u6709\u5173&#xff0c;\u5ffd\u7565\u65f6\u95f4&#xff0c;\u9ed8\u8ba4\u4e3a1\u3002\u5728\u8fd9\u4e2a\u4ee3\u7801\u4e0bF&#xff1a;(0, 0, 10)&#xff0c;t&#xff1a;1(\u9ed8\u8ba4)\u3001m&#xff1a;2kg(\u5047\u8bbe\u4e3a2kg&#xff0c;\u53ef\u4ee5\u4fee\u6539)&#xff0c;\u90a3\u4e48\u6b64\u65f6\u7684v &#061; 5m\/s\u3002<\/p>\n<h4>(4)VelocityChange<\/h4>\n<p>\u5f53\u6dfb\u52a0\u529b&#xff0c;\u4f7f\u7528\u7684\u6a21\u5f0f\u662fVelocityChange\u65f6&#xff1a;<\/p>\n<p>rigidbody.AddForce(Vector3.forward * 10, ForceMode.VelocityChange);<\/p>\n<p>\u8fd9\u4e2a\u6a21\u5f0f\u4e0b\u529b\u4f1a\u7ed9\u7269\u4f53\u6dfb\u52a0\u4e00\u4e2a\u77ac\u95f4\u7684\u901f\u5ea6&#xff0c;\u5ffd\u7565\u8d28\u91cf&#xff0c;\u5ffd\u7565\u65f6\u95f4\u3002\u5728\u8fd9\u4e2a\u4ee3\u7801\u4e0bF&#xff1a;(0, 0, 10)&#xff0c;t&#xff1a;1(\u9ed8\u8ba4)\u3001m&#xff1a;1(\u9ed8\u8ba4)&#xff0c;\u90a3\u4e48\u6b64\u65f6\u7684v &#061; 10m\/s\u3002<\/p>\n<h3>3\u3001\u529b\u573a<\/h3>\n<p>\u53ef\u4ee5\u76f4\u63a5\u5728Inspector\u9762\u677f\u4e2dAdd component\u6dfb\u52a0\u7ec4\u4ef6&#xff1a;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"182\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053458-68982f8209b16.png\" width=\"374\" \/><\/p>\n<p>\u8fd9\u6837\u5728\u67d0\u4e9b\u4e0d\u5fc5\u8981\u4f7f\u7528\u4ee3\u7801\u7684\u60c5\u51b5\u4e0b\u4f1a\u66f4\u52a0\u65b9\u4fbf\u3002<\/p>\n<h3>4\u3001\u521a\u4f53\u7684\u4f11\u7720<\/h3>\n<p>\u4e3a\u8282\u7701\u6027\u80fd&#xff0c;Unity\u4f1a\u5728\u4e00\u4e9b\u60c5\u51b5\u4e0b\u8ba9\u521a\u4f53\u4f11\u7720\u3002\u82e5\u662f\u4e0d\u5e0c\u671b\u521a\u4f53\u4f11\u7720&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u4ee3\u7801&#xff1a;<\/p>\n<p>        if(rigidbody.IsSleeping())<br \/>\n        {<br \/>\n            rigidbody.WakeUp();<br \/>\n        }<\/p>\n<h2>\u5341\u516d\u3001\u97f3\u9891\u76f8\u5173<\/h2>\n<p>Unity\u5e38\u7528\u97f3\u9891\u683c\u5f0f\u6709&#xff1a;wav\u3001mp3\u3001ogg\u3001aiff<\/p>\n<h3>1\u3001\u4ee3\u7801\u63a7\u5236\u64ad\u653e\u505c\u6b62\u6682\u505c<\/h3>\n<p>\u5728\u63a7\u5236\u64ad\u653e\u505c\u6b62\u6682\u505c\u524d&#xff0c;\u9700\u8981\u5148\u83b7\u53d6\u5bf9\u8c61\u4e0a\u4f9d\u9644\u7684\u97f3\u9891\u6e90\u811a\u672c&#xff1a;<\/p>\n<p>AudioSource audioSource;<\/p>\n<p>void Start()<br \/>\n{<br \/>\n    audioSource &#061; GetComponent&lt;AudioSource&gt;();<br \/>\n}<\/p>\n<p>\u5728\u83b7\u53d6\u97f3\u9891\u6e90\u811a\u672c\u540e&#xff0c;\u5c31\u53ef\u4ee5\u63a7\u5236\u97f3\u9891\u7684\u64ad\u653e\u3001\u505c\u6b62\u3001\u6682\u505c\u3002<\/p>\n<p>\u63a7\u5236\u64ad\u653e&#xff1a;audioSource.Play();<\/p>\n<p>\u63a7\u5236\u505c\u6b62&#xff1a;audioSource.Stop();<\/p>\n<p>\u63a7\u5236\u6682\u505c&#xff1a;audioSource.Pause();<\/p>\n<p>void Update()<br \/>\n{<br \/>\n    if(Input.GetKeyDown(KeyCode.P))<br \/>\n    {<br \/>\n        audioSource.Play();<br \/>\n    }<\/p>\n<p>    if(Input.GetKeyDown(KeyCode.S))<br \/>\n    {<br \/>\n        audioSource.Stop();<br \/>\n    }<\/p>\n<p>    if(Input.GetKeyDown(KeyCode.Space))<br \/>\n    {<br \/>\n        audioSource.Pause();<br \/>\n    }<br \/>\n}<\/p>\n<p>\u6b64\u5916&#xff0c;\u8fd8\u8981\u4e00\u4e9b\u4e0d\u662f\u5f88\u5e38\u7528\u7684&#xff0c;\u6bd4\u5982<\/p>\n<p>\u63a7\u5236\u505c\u6b62\u6682\u505c(\u548c\u6682\u505c\u540e\u4f7f\u7528paly()\u5176\u5b9e\u4e00\u6837)&#xff1a;audioSource.UnPause();<\/p>\n<p>\u5ef6\u8fdfn\u79d2\u540e\u64ad\u653e&#xff1a;audioSource.PlayDelayed(n);<\/p>\n<p>void Update()<br \/>\n{<br \/>\n    if (Input.GetKeyDown(KeyCode.X))<br \/>\n    {<br \/>\n        audioSource.UnPause();<br \/>\n    }<\/p>\n<p>    if (Input.GetKeyDown(KeyCode.X))<br \/>\n    {<br \/>\n        \/\/\u586b\u5199\u7684\u662f\u79d2\u6570<br \/>\n        audioSource.PlayDelayed(5);<br \/>\n    }<br \/>\n}<\/p>\n<h3>2\u3001\u68c0\u6d4b\u97f3\u6548\u64ad\u653e\u5b8c\u6bd5<\/h3>\n<p>\u5982\u679c\u5e0c\u671b\u67d0\u4e2a\u97f3\u6548\u64ad\u653e\u5b8c\u6bd5\u540e&#xff0c;\u60f3\u8981\u505a\u4ec0\u4e48\u4e8b&#xff0c;\u90a3\u4e48\u5c31\u53ef\u4ee5\u5728Update\u751f\u547d\u51fd\u6570\u4e2d\u4e0d\u65ad\u5730\u53bb\u68c0\u6d4b\u97f3\u9891\u662f\u5426\u8fd8\u5728\u64ad\u653e<\/p>\n<p>void Update()<br \/>\n{<br \/>\n    if(audioSource.isPlaying)<br \/>\n    {<br \/>\n        print(&#034;\u64ad\u653e\u4e2d&#034;);<br \/>\n    }<br \/>\n    else<br \/>\n    {<br \/>\n        print(&#034;\u64ad\u653e\u5b8c\u6bd5&#034;);<br \/>\n    }<br \/>\n}<\/p>\n<h3>3\u3001\u52a8\u6001\u63a7\u5236\u97f3\u6548\u64ad\u653e<\/h3>\n<p>\u5f53\u6211\u4eec\u9700\u8981\u505a\u53d7\u4f24\u97f3\u6548\u3001\u6218\u8d25\u97f3\u6548\u7b49&#xff0c;\u5c31\u9700\u8981\u52a8\u6001\u63a7\u5236\u97f3\u6548\u64ad\u653e\u3002\u7b2c\u4e00\u79cd\u52a8\u6001\u64ad\u653e\u97f3\u6548\u7684\u65b9\u6cd5\u5c31\u662f\u4e0a\u6587\u7b2c\u4e00\u70b9&#xff0c;\u4ee3\u7801\u63a7\u5236\u64ad\u653e\u505c\u6b62\u6682\u505c&#xff0c;\u76f4\u63a5\u5728\u8981\u64ad\u653e\u97f3\u6548\u7684\u5bf9\u8c61\u4e0a\u6302\u8f7d\u811a\u672c&#xff0c;\u63a7\u5236\u64ad\u653e\u3002\u6b64\u5916&#xff0c;\u8fd8\u8981\u4e24\u79cd\u65b9\u6cd5&#xff1a;<\/p>\n<h4>(1)\u5b9e\u4f8b\u5316\u6302\u8f7d\u4e86\u97f3\u6548\u6e90\u811a\u672c\u7684\u5bf9\u8c61<\/h4>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u7528\u7684\u6bd4\u8f83\u5c11\u3002\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u81ea\u8eab\u6302\u6709\u97f3\u6548\u6e90\u811a\u672c\u7684\u9884\u8bbe\u4f53&#xff0c;\u5728\u4eba\u7269\u53d7\u4f24\u65f6&#xff0c;\u5b9e\u4f8b\u5316\u8fd9\u4e2a\u9884\u8bbe\u4f53\u6765\u8fbe\u5230\u6548\u679c&#xff1a;<\/p>\n<p>Instrantiate(obj)<\/p>\n<h4>(2)\u7528\u4e00\u4e2aAudioSouce\u63a7\u5236\u64ad\u653e\u4e0d\u540c\u97f3\u6548<\/h4>\n<p>\u4e00\u4e2a\u5bf9\u8c61\u53ef\u4ee5\u6302\u8f7d\u591a\u4e2aAudioSouce\u3002\u6211\u4eec\u53ef\u4ee5\u81ea\u5df1\u521b\u5efa\u4e00\u4e2a\u97f3\u9891\u5207\u7247&#xff0c;\u5e76\u4e14\u5c06\u9700\u8981\u64ad\u653e\u7684\u97f3\u6548\u62d6\u5165Inspector\u9762\u677f\u3002\u4e4b\u540e\u5c31\u53ef\u4ee5\u81ea\u884c\u521b\u5efaAudioSouce\u8fdb\u884c\u5173\u8054clip&#xff0c;\u8fbe\u5230\u63a7\u5236\u64ad\u653e\u4e0d\u540c\u97f3\u6548\u7684\u6548\u679c\u3002<\/p>\n<p>public AudioClip clip;<\/p>\n<p>void Start()<br \/>\n{<br \/>\n    audioSource &#061; GetComponent&lt;AudioSource&gt;();<br \/>\n    AudioSource aus &#061; this.gameObject.AddComponent&lt;AudioSource&gt;();<br \/>\n    aus.clip &#061; clip;<br \/>\n    aus.Play();<br \/>\n}<\/p>\n<h3>4\u3001\u9ea6\u514b\u98ce\u76f8\u5173<\/h3>\n<h4>(1)\u83b7\u53d6\u8bbe\u5907\u9ea6\u514b\u98ce\u4fe1\u606f<\/h4>\n<p>\u53ef\u4ee5\u4f7f\u7528Microphone.devices\u83b7\u53d6\u8bbe\u5907\u7684\u6240\u6709\u9ea6\u514b\u98ce\u8bbe\u5907<\/p>\n<p>    void Start()<br \/>\n    {<br \/>\n        string[] strs &#061; Microphone.devices;<br \/>\n        for(int i &#061; 0; i &lt; strs.Length; i&#043;&#043;)<br \/>\n        {<br \/>\n            print(strs[i]);<br \/>\n        }<br \/>\n    }<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"96\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053458-68982f8219110.png\" width=\"338\" \/><\/p>\n<h4>(2)\u5f00\u59cb\u5f55\u5236\u3001\u7ed3\u675f\u5f55\u5236<\/h4>\n<p>\u5f00\u59cb\u5f55\u5236\u4f7f\u7528\u65b9\u6cd5&#xff1a;Microphone.Start()&#xff0c;\u5b83\u4f1a\u8fd4\u56de\u97f3\u9891\u5207\u7247&#xff0c;\u53ef\u4ee5\u521b\u5efa\u97f3\u9891\u5207\u7247\u63a5\u6536\u3002\u80fd\u4f20\u51654\u4e2a\u53c2\u6570&#xff1a;<\/p>\n<p>\u53c2\u6570\u4e00&#xff1a;\u8bbe\u5907\u540d&#xff0c;\u4f20\u7a7a\u4f7f\u7528\u9ed8\u8ba4\u8bbe\u5907<\/p>\n<p>\u53c2\u6570\u4e8c&#xff1a;\u8d85\u8fc7\u5f55\u5236\u65f6\u957f\u540e&#xff0c;\u662f\u5426\u91cd\u5934\u5f55\u5236\u3002\u586btrue\u5c31\u662f\u91cd\u5934&#xff0c;false\u4e0d\u91cd\u5934<\/p>\n<p>\u53c2\u6570\u4e09&#xff1a;\u5f55\u5236\u65f6\u957f(\u79d2)<\/p>\n<p>\u53c2\u6570\u56db&#xff1a;\u91c7\u6837\u7387<\/p>\n<p>\u7ed3\u675f\u5f55\u5236\u4f7f\u7528\u65b9\u6cd5&#xff1a;Microphone.End()&#xff0c;\u4f20\u5165\u4e00\u4e2a\u53c2\u6570&#xff1a;\u8bbe\u5907\u540d<\/p>\n<p>void Update()<br \/>\n{<br \/>\n    if (Input.GetKeyDown(KeyCode.Space))<br \/>\n    {<br \/>\n        clip &#061; Microphone.Start(null, false, 10, 44100);<br \/>\n    }<\/p>\n<p>    if (Input.GetKeyUp(KeyCode.Space))<br \/>\n    {<br \/>\n        Microphone.End(null);<br \/>\n        AudioSource s &#061; this.GetComponent&lt;AudioSource&gt;();<br \/>\n        if(s &#061;&#061; null)<br \/>\n        {<br \/>\n            s &#061; this.gameObject.AddComponent&lt;AudioSource&gt;();<br \/>\n        }<br \/>\n        s.clip &#061; clip;<br \/>\n        s.Play();<br \/>\n    }<br \/>\n}<\/p>\n<h4>(3)\u83b7\u53d6\u97f3\u9891\u6570\u636e\u7528\u4e8e\u5b58\u50a8\u6216\u4f20\u8f93<\/h4>\n<p>\u7528\u4e8e\u5b58\u50a8\u6570\u7ec4\u6570\u636e\u7684\u957f\u5ea6&#xff0c;\u662f\u7528\u58f0\u9053\u6570*\u526a\u8f91\u957f\u5ea6&#xff0c;\u8fd9\u662f\u56fa\u5b9a\u7684&#xff0c;\u4f7f\u7528&#xff1a;clip.channels*clip.samples\u3002\u90a3\u4e48\u521b\u5efa\u6570\u7ec4\u5c31\u53ef\u4ee5\u4f7f\u7528\u4ee3\u7801&#xff1a;float[] f &#061; new float[clip.channels*clip.samples];<\/p>\n<p>\u5c06\u97f3\u9891\u6570\u636e\u5b58\u5165\u6570\u7ec4\u4f7f\u7528&#xff1a;clip.GetData(f, 0)&#xff0c;\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u5b58\u50a8\u7684\u6570\u7ec4&#xff0c;\u7b2c\u4e8c\u4e2a\u53c2\u6570\u662f\u504f\u79fb\u4f4d\u7f6e&#xff0c;\u9ed8\u8ba4\u4e3a0<\/p>\n<p>\u8fd9\u91cc\u7ed3\u5408\u4e0a\u6587\u5f00\u59cb\u7ed3\u675f\u5f55\u5236&#xff0c;\u6765\u8fdb\u884c\u97f3\u9891\u6570\u636e\u7684\u83b7\u53d6\u3002<\/p>\n<p>void Update()<br \/>\n{<br \/>\n    if (Input.GetKeyDown(KeyCode.Space))<br \/>\n    {<br \/>\n        clip &#061; Microphone.Start(null, false, 10, 44100);<br \/>\n    }<\/p>\n<p>    if (Input.GetKeyUp(KeyCode.Space))<br \/>\n    {<br \/>\n        Microphone.End(null);<br \/>\n        AudioSource s &#061; this.GetComponent&lt;AudioSource&gt;();<br \/>\n        if(s &#061;&#061; null)<br \/>\n        {<br \/>\n            s &#061; this.gameObject.AddComponent&lt;AudioSource&gt;();<br \/>\n        }<br \/>\n        s.clip &#061; clip;<br \/>\n        s.Play();<\/p>\n<p>        \/\/\u521b\u5efa\u6570\u7ec4<br \/>\n        float[] f &#061; new float[clip.channels*clip.samples];<br \/>\n        \/\/\u5b58\u50a8\u6570\u636e<br \/>\n        clip.GetData(f, 0);<\/p>\n<p>        print(f.Length);<br \/>\n    }<br \/>\n}<\/p>\n<p>\u81f3\u6b64&#xff0c;\u5165\u95e8\u90e8\u5206\u7ed3\u675f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb32\u6b21\u3002\u5199\u672c\u7cfb\u5217\u7684\u76ee\u7684\u662f\u56de\u987e\u5df2\u7ecf\u5b66\u8fc7\u7684\u77e5\u8bc6\u3001\u8bb0\u5f55\u65b0\u5b66\u4e60\u7684\u77e5\u8bc6\u6216\u662f\u8bb0\u5f55\u5fc3\u5f97\u7406\u89e3\uff0c\u65b9\u4fbf\u81ea\u5df1\u4ee5\u540e\u5feb\u901f\u590d\u4e60\uff0c\u51cf\u5c11\u9057\u5fd8\u3002\u4e3b\u8981\u662fC#\u4ee3\u7801\u90e8\u5206\u3002<\/p>\n","protected":false},"author":2,"featured_media":50866,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[183,371,735,305],"topic":[],"class_list":["post-50877","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-unity","tag-371","tag-735","tag-305"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Unity\u7b14\u8bb0(\u56db)\u2014\u2014Camera\u3001\u78b0\u649e\u68c0\u6d4b\u51fd\u6570\u3001\u521a\u4f53\u52a0\u529b\u3001\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/50877.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Unity\u7b14\u8bb0(\u56db)\u2014\u2014Camera\u3001\u78b0\u649e\u68c0\u6d4b\u51fd\u6570\u3001\u521a\u4f53\u52a0\u529b\u3001\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb32\u6b21\u3002\u5199\u672c\u7cfb\u5217\u7684\u76ee\u7684\u662f\u56de\u987e\u5df2\u7ecf\u5b66\u8fc7\u7684\u77e5\u8bc6\u3001\u8bb0\u5f55\u65b0\u5b66\u4e60\u7684\u77e5\u8bc6\u6216\u662f\u8bb0\u5f55\u5fc3\u5f97\u7406\u89e3\uff0c\u65b9\u4fbf\u81ea\u5df1\u4ee5\u540e\u5feb\u901f\u590d\u4e60\uff0c\u51cf\u5c11\u9057\u5fd8\u3002\u4e3b\u8981\u662fC#\u4ee3\u7801\u90e8\u5206\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/50877.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-10T05:34:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053456-68982f806edcf.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/50877.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/50877.html\",\"name\":\"Unity\u7b14\u8bb0(\u56db)\u2014\u2014Camera\u3001\u78b0\u649e\u68c0\u6d4b\u51fd\u6570\u3001\u521a\u4f53\u52a0\u529b\u3001\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-10T05:34:59+00:00\",\"dateModified\":\"2025-08-10T05:34:59+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/50877.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/50877.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/50877.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Unity\u7b14\u8bb0(\u56db)\u2014\u2014Camera\u3001\u78b0\u649e\u68c0\u6d4b\u51fd\u6570\u3001\u521a\u4f53\u52a0\u529b\u3001\u97f3\u9891\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Unity\u7b14\u8bb0(\u56db)\u2014\u2014Camera\u3001\u78b0\u649e\u68c0\u6d4b\u51fd\u6570\u3001\u521a\u4f53\u52a0\u529b\u3001\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/50877.html","og_locale":"zh_CN","og_type":"article","og_title":"Unity\u7b14\u8bb0(\u56db)\u2014\u2014Camera\u3001\u78b0\u649e\u68c0\u6d4b\u51fd\u6570\u3001\u521a\u4f53\u52a0\u529b\u3001\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb32\u6b21\u3002\u5199\u672c\u7cfb\u5217\u7684\u76ee\u7684\u662f\u56de\u987e\u5df2\u7ecf\u5b66\u8fc7\u7684\u77e5\u8bc6\u3001\u8bb0\u5f55\u65b0\u5b66\u4e60\u7684\u77e5\u8bc6\u6216\u662f\u8bb0\u5f55\u5fc3\u5f97\u7406\u89e3\uff0c\u65b9\u4fbf\u81ea\u5df1\u4ee5\u540e\u5feb\u901f\u590d\u4e60\uff0c\u51cf\u5c11\u9057\u5fd8\u3002\u4e3b\u8981\u662fC#\u4ee3\u7801\u90e8\u5206\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/50877.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-10T05:34:59+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250810053456-68982f806edcf.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/50877.html","url":"https:\/\/www.wsisp.com\/helps\/50877.html","name":"Unity\u7b14\u8bb0(\u56db)\u2014\u2014Camera\u3001\u78b0\u649e\u68c0\u6d4b\u51fd\u6570\u3001\u521a\u4f53\u52a0\u529b\u3001\u97f3\u9891 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-10T05:34:59+00:00","dateModified":"2025-08-10T05:34:59+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/50877.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/50877.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/50877.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Unity\u7b14\u8bb0(\u56db)\u2014\u2014Camera\u3001\u78b0\u649e\u68c0\u6d4b\u51fd\u6570\u3001\u521a\u4f53\u52a0\u529b\u3001\u97f3\u9891"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/50877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=50877"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/50877\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/50866"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=50877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=50877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=50877"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=50877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}