PhysicMaterialConstructor

Switch to Manual
public PhysicMaterial ();

Description

创建新材质。

请注意,虽然此函数使您可以从脚本创建新物理材质,不过通常从 Editor 创建和分配材质会更方便。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Collider coll; void Start() { coll = GetComponent<Collider>(); PhysicMaterial material = new PhysicMaterial(); material.dynamicFriction = 1; coll.material = material; } }

public PhysicMaterial (string name);

Description

创建名为 name 的新材质。