浏览代码

Replace return w/ reference

/hotfix-v0.9.2a
Arthur Juliani 7 年前
当前提交
5b52e610
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 8
      unity-environment/Assets/ML-Agents/Scripts/Agent.cs

8
unity-environment/Assets/ML-Agents/Scripts/Agent.cs


for (int i = 0; i < brain.brainParameters.cameraResolutions.Length; i++)
{
info.visualObservations.Add(ObservationToTexture(
ObservationToTexture(
textureArray[i]));
ref textureArray[i]);
info.visualObservations.Add(textureArray[i]);
}
info.reward = reward;

/// <param name="width">Width of resulting 2D texture.</param>
/// <param name="height">Height of resulting 2D texture.</param>
/// <param name="texture2D">Texture2D to render to.</param>
public static Texture2D ObservationToTexture(Camera obsCamera, int width, int height, Texture2D texture2D)
public static void ObservationToTexture(Camera obsCamera, int width, int height, ref Texture2D texture2D)
{
Rect oldRec = obsCamera.rect;
obsCamera.rect = new Rect(0f, 0f, 1f, 1f);

obsCamera.rect = oldRec;
RenderTexture.active = prevActiveRT;
RenderTexture.ReleaseTemporary(tempRT);
return texture2D;
}
}
}
正在加载...
取消
保存