-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[change] public SensorComponent fields to properties, add custom editor #3564
Conversation
EditorGUI.BeginDisabledGroup(Application.isPlaying); | ||
{ | ||
EditorGUILayout.PropertyField(so.FindProperty("m_SensorName"), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would make more sense to store "m_SensorName" and such in private const in case they are used somewhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, not quite sure what you mean. The user needs to assign a unique name to each sensor so that we can sort them deterministically, so the name here can't be const.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think he means the string, make it a variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here or in the component? We currently only use them in one place, and it's kinda redundant because of reflection.
We could do something like this:
https://stackoverflow.com/a/33059272/224264
although to use nameof
we'd need to make the fields internal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we only use it here, I think it is fine.
|
||
EditorGUI.EndDisabledGroup(); | ||
|
||
if (EditorGUI.EndChangeCheck()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think it is useful to check for changes is nothing happens when something changed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revised based on feedback from @awjuliani - the Camera and compression type can now be changed during runtime (since they don't affect the observation shape).
[HideInInspector] | ||
[SerializeField] | ||
[FormerlySerializedAs("m_TeamID")] | ||
[HideInInspector, SerializeField, FormerlySerializedAs("m_TeamID")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do that ?!
Should we try to be consistent and make it the same way everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a simple find-and-replace for the ones for HideInInspector+ SerializeField+ FormerlySerializedAs. That's as much effort as I want to put into it for this PR.
Proposed change(s)
For both CameraSensorComponent and RenderTextureSensorComponent:
Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)
Types of change(s)
Checklist
Other comments