ドキュメント

Unity Engine

Unity Engine

GetLayerCost(int)

Gets the cost for crossing ground of a particular type.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEngine.AI
  • Assembly: UnityEngine.AIModule
注意
Deprecated. Use GetAreaCost instead.
public float GetLayerCost(int layer)

Parameters

layer

Layer index.

Returns

Type

Description

floatCurrent cost of specified layer.

Remarks

The cost of a path is the amount of "difficulty" involved in following it - the shortest path may not be the quickest if it passes over difficult ground, such as mud, snow, etc. Different types of ground are denoted by navmesh layers in Unity. The cost of a particular layer is given in cost units per distance unit. Note that the cost of a path applies to the pathfinding only and does not automatically affect the movement speed of the agent when following the path. Indeed, the path's cost may denote other factors such as danger (safe but long path through a minefield) or visibility (long path that keeps a character in the shadows).