Skip to content

FindObjectOfType<Academy> impacts performance #2959

Closed
@robinerd

Description

@robinerd

Multiple places in the ML-agents code use FindObjectOfType for getting the Academy.
This gives lag spikes for every time an agent is enabled or given a new behaviour.
In large scenes this lag spike can be rather noticable. It can also cause increased scene load times if there are many agents.
In my current project we have made Academy into a singleton, but there are other ways too. Just avoid searching the entire scene would be good :)
Cheers!

Metadata

Metadata

Assignees

Labels

discussionIssue contains general discussion.staleIssues that have been idle for a while. Automatically closed by a bot if idle for too long.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions