Skip to content

Commit 2d09e92

Browse files
committed
Add docs on adding new ScriptableObjects
1 parent b4acc93 commit 2d09e92

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Documentation/Contributing/CodingGuidelines.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Omitting the namespace for an interface, class or data type will cause your chan
9797

9898
### Adding new MonoBehaviour scripts
9999

100-
When adding new MonoBehaviour scripts with a pull-request, ensure the [`AddComponentMenu`](https://docs.unity3d.com/ScriptReference/AddComponentMenu.html) attribute is applied to all applicable files. This ensures the component is easily discoverable in the editor under the *Add Component* button. The attribute flag is not necessary if the component cannot show up in editor such as an abstract class.
100+
When adding new MonoBehaviour scripts with a pull request, ensure the [`AddComponentMenu`](https://docs.unity3d.com/ScriptReference/AddComponentMenu.html) attribute is applied to all applicable files. This ensures the component is easily discoverable in the editor under the *Add Component* button. The attribute flag is not necessary if the component cannot show up in editor such as an abstract class.
101101

102102
In the example below, the *Package here* should be filled with the package location of the component. If placing an item in *MixedRealityToolkit.SDK* folder, then the package will be *SDK*. If placing an item in the *MixedRealityToolkit* folder, then use *Core* as the string to insert.
103103

@@ -106,6 +106,19 @@ In the example below, the *Package here* should be filled with the package locat
106106
public class MyNewComponent : MonoBehaviour
107107
```
108108

109+
### Adding new ScriptableObjects
110+
111+
When adding new ScriptableObject scripts, ensure the [`CreateAssetMenu`](https://docs.unity3d.com/ScriptReference/CreateAssetMenu.html) attribute is applied to all applicable files. This ensures the component is easily discoverable in the editor via the asset creation menus. The attribute flag is not necessary if the component cannot show up in editor such as an abstract class.
112+
113+
In the example below, the *Subfolder* should be filled with the MRTK subfolder, if applicable. If placing an item in *MixedRealityToolkit.Providers* folder, then the package will be *Providers*. If placing an item in the *MixedRealityToolkit* folder, set this to "Profiles".
114+
115+
In the example below, the *MyNewService | MyNewProvider* should be filled with the your new class' name, if applicable. If placing an item in the *MixedRealityToolkit* folder, leave this string out.
116+
117+
```c#
118+
[CreateAssetMenu(fileName = "MyNewProfile", menuName = "Mixed Reality Toolkit/{Subfolder}/{MyNewService | MyNewProvider}/MyNewProfile")]
119+
public class MyNewProfile : ScriptableObject
120+
```
121+
109122
### Spaces vs tabs
110123

111124
Please be sure to use 4 spaces instead of tabs when contributing to this project.

0 commit comments

Comments
 (0)