Skip to content

Conversation

david-c-kline
Copy link

This change completes the migration of MRTK code from directly calling into the MixedRealityToolkit object to obtain instances of core services. While this is still a viable pattern for client code, the prefered method is to use MixedRealityServiceRegistry.TryGetService().

This completes the work started with #4099 and is related to the ongoing effort to fully implement #3545.

@david-c-kline
Copy link
Author

/azp run mrtk_pr

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@david-c-kline david-c-kline changed the title Registry input Update systems and demos to reference the input system via the service registry May 13, 2019
return inputSystem;
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This overall change looks fine, it's is weird to me though that we go from one singleton (i.e. MixedRealityToolkit) to another (MixedRealityServiceRegistry) - in this case now we put the onus of caching and reaching out to all of the consumers (i.e. this exact code is copy pasted in a lot of the things here)

If every single caller is handling caching it almost feels like MixedRealityServiceRegistry.TryGetService should cache as well (i.e. why not share some of this code at a lower level)

Copy link
Author

Choose a reason for hiding this comment

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

we go from one singleton (i.e. MixedRealityToolkit) to another (MixedRealityServiceRegistry)

MixedRealityServiceRegistry is a static c# class that has no scene presence (it is not a Unity object).

If every single caller is handling caching it almost feels like MixedRealityServiceRegistry.TryGetService should cache as well (i.e. why not share some of this code at a lower level)

Interesting thought. This is actually very similar to the original pattern where many scripts would attempt to get the service if a previous instance had not yet been found (ex: was null)

Copy link
Author

Choose a reason for hiding this comment

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

As an aside, caching is an optimization and is not required. Any script can request a system at the time it is needed.

@wiwei
Copy link
Contributor

wiwei commented May 13, 2019

Alrighty, done with this set of comments.

Copy link
Contributor

@Railboy Railboy left a comment

Choose a reason for hiding this comment

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

Really like the direction this is moving.

@david-c-kline
Copy link
Author

/azp run mrtk_pr

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@luis-valverde-ms luis-valverde-ms left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@wiwei
Copy link
Contributor

wiwei commented May 14, 2019

/azp run mrtk_docs

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@david-c-kline david-c-kline merged commit 90913e2 into microsoft:mrtk_development May 14, 2019
@david-c-kline david-c-kline deleted the registryInput branch May 15, 2019 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants