/// <summary> /// Applies the given concrete dataprovider type properties to the provided <see cref="IMixedRealityServiceConfiguration"/> instance (as represented by <see cref="ServiceConfigurationProperties"/>). /// Requires <see cref="MixedRealityDataProviderAttribute"/> on concrete type class to pull initial values /// that will be applied to the <see cref="ServiceConfigurationProperties"/> container SerializedProperties /// </summary> protected virtual void ApplyProviderConfiguration(Type dataProviderType, ServiceConfigurationProperties providerProperties) { if (dataProviderType != null) { if (MixedRealityDataProviderAttribute.Find(dataProviderType) is MixedRealityDataProviderAttribute providerAttribute) { providerProperties.componentName.stringValue = !string.IsNullOrWhiteSpace(providerAttribute.Name) ? providerAttribute.Name : dataProviderType.Name; providerProperties.providerProfile.objectReferenceValue = providerAttribute.DefaultProfile; providerProperties.runtimePlatform.intValue = (int)providerAttribute.RuntimePlatforms; } else { providerProperties.componentName.stringValue = dataProviderType.Name; } serializedObject.ApplyModifiedProperties(); } }
private void ApplyDataProviderConfiguration( System.Type type, SerializedProperty providerName, SerializedProperty configurationProfile, SerializedProperty runtimePlatform) { if (type != null) { MixedRealityDataProviderAttribute providerAttribute = MixedRealityDataProviderAttribute.Find(type) as MixedRealityDataProviderAttribute; if (providerAttribute != null) { providerName.stringValue = !string.IsNullOrWhiteSpace(providerAttribute.Name) ? providerAttribute.Name : type.Name; configurationProfile.objectReferenceValue = providerAttribute.DefaultProfile; runtimePlatform.intValue = (int)providerAttribute.RuntimePlatforms; } else { providerName.stringValue = type.Name; } serializedObject.ApplyModifiedProperties(); } }