CreateComponent<T>()
Creates a new instance of a given scriptable object and adds it as a sub-asset to the build profile. Only one instance per type can be embedded within a build profile.
阅读时间1 分钟最后更新于 14 天前
Definition
- Type: Method
- Namespace: UnityEditor.Build.Profile
- Assembly: UnityEditor.CoreModule
public T CreateComponent<T>() where T : Object
Returns
Type | Description |
|---|---|
| T | ScriptableObject type to instantiate. |
Remarks
Use this method to add BuildProfilePlayerSettings, BuildProfileGraphicsSettings, or BuildProfileQualitySettings to a build profile. Unity initializes the new component as follows:
- BuildProfilePlayerSettings starts with a copy of the global Player settings.
- BuildProfileGraphicsSettings starts with the current global graphics settings.
- BuildProfileQualitySettings starts with the global quality levels for the build profile's platform.
If you pass PlayerSettings as , this method throws an . To give a build profile its own Player settings, pass BuildProfilePlayerSettings as . The method throws an if you add BuildProfilePlayerSettings for a platform profile from the Platforms pane.
TArgumentExceptionTInvalidOperationExceptionNote: This method is restricted to ScriptableObject types and doesn't support all settings visible in the Build Profiles window.