浏览代码

call init in awake()

/release_16_fix_gridsensor
Ruo-Ping Dong 3 年前
当前提交
799cdce7
共有 1 个文件被更改,包括 18 次插入8 次删除
  1. 26
      com.unity.ml-agents.extensions/Runtime/Sensors/GridSensor.cs

26
com.unity.ml-agents.extensions/Runtime/Sensors/GridSensor.cs


CellActivity = new Color[NumCells];
}
/// <summary>
/// Calls the initialization methods. Creates the data storing properties used to send the data
/// Establishes
/// </summary>
public virtual void Start()
public void Awake()
{
Initialize();
}
public virtual void Initialize()
{
InitGridParameters();
InitDepthType();

byteSizesBytesList = new List<byte[]>();
m_perceptionTexture2D = new Texture2D(GridNumSideX, GridNumSideZ, TextureFormat.RGB24, false);
}
/// <summary>
/// Calls the initialization methods. Creates the data storing properties used to send the data
/// Establishes
/// </summary>
public virtual void Start()
{
Initialize();
}
/// <inheritdoc cref="ISensor.Reset"/>

/// <param name="normalizedDistance">A float between 0 and 1 describing the ratio of
/// the distance currentColliderGo is compared to the edge of the gridsensor</param>
/// <example>
/// Here is an example of extenind GetObjectData to include information about a potential Rigidbody:
/// Here is an example of extend GetObjectData to include information about a potential Rigidbody:
/// <code>
/// protected override float[] GetObjectData(GameObject currentColliderGo,
/// float type_index, float normalized_distance)

/// <summary>
/// LoadObjectData - If the GameObject matches a tag, GetObjectData is called to extract the data from the GameObject
/// then the data is transformed based on the GridDepthType of the gridsensor.
/// Further documetation on the GridDepthType can be found below
/// Further documentation on the GridDepthType can be found below
/// </summary>
/// <param name="currentColliderGo">The game object that was found colliding with a certain cell</param>
/// <param name="cellIndex">The index of the current cell</param>

if (ShowGizmos)
{
if (Application.isEditor && !Application.isPlaying)
Start();
Initialize();
Perceive();

正在加载...
取消
保存