/// <summary> /// Provides the PhysicsMaterial instance for the given name. /// </summary> /// <param name="name">Identifying name of the PhysicsMaterial.</param> /// <returns>PhysicsMaterial identified by the name. Returns null if named material does not exist.</returns> public static PhysicsMaterial GetPhysicsMaterial(string name) { PhysicsMaterial material = null; if (name == null) { return(material); } _materials.TryGetValue(name, out material); return(material); }
/// <summary> /// Initializes the PhysicsMaterial database. Also creates a blank PhysicsMaterial with the name "default". /// </summary> static PhysicsMaterial() { _materials = new Dictionary <string, PhysicsMaterial>(); _ = new PhysicsMaterial("default"); }