Legacy Documentation: Version 5.1
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

PhysicMaterial.PhysicMaterial

Switch to Manual
public PhysicMaterial()

Description

Creates a new material.

Note that although this function lets you create a new physic material from a script, it is generally easier to create and assign the material from the editor.

var coll: Collider;

function Start() { coll = GetComponent.<Collider>(); var material = new PhysicMaterial(); material.dynamicFriction = 1; coll.material = material; }

public PhysicMaterial(name: string)

Parameters

Description

Creates a new material named name.