Skip to content

RaycastPerceptionComponent custom editor #3484

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

Merged
merged 10 commits into from
Feb 25, 2020

Conversation

chriselion
Copy link
Contributor

@chriselion chriselion commented Feb 23, 2020

Proposed change(s)

  • Make RayPerceptionSensorComponent fields private. Most of them now have public getters and setters. Ones that affect the observation shape of the sensor (num rays, tags, and stacks) properties are not public. This allows changing of some sensor values at runtime (e.g. someone asked for changing the ray length as part of generalization).
  • Add a custom editor for RayPerceptionSensorComponent. Parameters that aren't allowed to change during training/inference get disabled in play mode.
  • Make debug drawing for RayPerceptionSensorComponent work outside of play mode. Slight behavior change in that only selected Agent(s) are drawn.

Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)

https://jira.unity3d.com/browse/MLA-688
https://jira.unity3d.com/browse/MLA-561

#3412
https://forum.unity.com/threads/no-visible-gizmos-for-ray-perception-sensor-component-3d.824529/
https://forum.unity.com/threads/access-rayperceptionsensor-components.823107/

Types of change(s)

  • Bug fix
  • New feature
  • Code refactor
  • Breaking change
  • Documentation update
  • Other (please describe)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have added updated the changelog (if applicable)
  • I have added necessary documentation (if applicable)
  • I have updated the migration guide (if applicable)

Other comments

@chriselion
Copy link
Contributor Author

out

[Header("3D Properties", order = 100)]
[HideInInspector]
[SerializeField]
[FormerlySerializedAs("startVerticalOffset")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: attributes should go on the same line if they fit.


//[HideInInspector]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. I'm not quite clear why we have this in the first place for things like this:

[HideInInspector]
[SerializeField]
string m_BehaviorName = "My Behavior";

but then expose it in the editor:
EditorGUILayout.PropertyField(so.FindProperty("m_BehaviorName"));

I had to remove it here to get the list to expand properly.

Copy link
Contributor

@surfnerd surfnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Food for thought: I wonder if these would be helpful in a player build as well. 🤔

@chriselion
Copy link
Contributor Author

I wonder if these would be helpful in a player build as well.

Do you mean the gizmo drawing? What's the typical setup?

@chriselion chriselion changed the title Develop raycast custom editor RaycastPerceptionComponent custom editor Feb 25, 2020
@chriselion chriselion merged commit 928761c into master Feb 25, 2020
@delete-merged-branch delete-merged-branch bot deleted the develop-raycast-custom-editor branch February 25, 2020 22:51
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants