【发布时间】:2016-12-29 03:03:54
【问题描述】:
我正在编写一个非常简单的类来存储数据(至少目前是这样),以便在 Unity 项目中用于学习 AI。我希望能够轻松地在检查器中自定义多个代理,并且垂直堆叠的复选框数量使我的项目的这一部分主宰了检查器。如果我可以简单地让一个部分利用检查器右侧的充足空间,那将不那么难看。
我已经阅读了很多关于自定义属性抽屉和检查器窗口的内容,但似乎需要做很多工作,包括重写整个类的显示方式,只需要一次更改。
作为参考,这里是类本身。
[System.Serializable]
public class NNInfo
{
public string networkName = "Agent";
[Header("Movement Properties")]
public float movementSpeed = 10f;
public float rotationSpeed = 1f;
[Header("Learning Properties")]
public float learningRate = 0.1f;
public float momentum = 0f;
public Rewards rewardFunc;
public int[] hiddenLayers;
[Header("Other Properties")]
public int maxHealth = 1000;
[Header("Optional Inputs")]
public bool m_PointToNearestBall = false; // input which is 1 while the agent is facing a ball and -1 when facing away
public bool m_DistanceToNearestBall = false; // input which is 1 while the agent is at the ball and -1 when at max possible distance away
public bool m_PointToEndzone = false; // similar to m_PointToNearestBall but for the endzone
public bool m_Position = false; // two inputs which inform the player of its normalized x and y coordinates on the field
public bool m_WhetherHoldingBall = false; // tells the player whether its holding a ball
public bool m_CanSeeHealth = false; // Whether the player can know its own health
[Header("Optional Outputs")]
public bool m_ForwardLeft = false; // turn left and move forward simultaneously
public bool m_ForwardRight = false; // turn right and move forward simultaneously
public bool m_Reverse = false; // move backwards
public bool m_Flip = false; // instantly switch to opposite direction
public bool m_TurnToBall = false; // instantly turn to face nearest ball
public bool m_TurnToLeft = false; // instantly turn to face left side of field
public bool m_Attack = false; // attack a player (or idle if no contact)
}
【问题讨论】:
-
这是一个非常酷的想法,但我认为这是不可能的(以一种简单的方式)。
-
我认为这是主题不属于 SO。由于问题是关于 Unity Dev 工具的,它与纯编程没有直接关系。它应该属于 Game Dev (gamedev.stackexchange.com) 或者为什么不属于 Unity Answers 网站 (answers.unity3d.com)。
-
要完成,您需要更新编辑器代码(或编写您自己的函数)。难度不大,网上有很多教程。