@@ -65,7 +65,7 @@ private static string GetIndentation(int identation)
65
65
return stringBuilder . ToString ( ) ;
66
66
}
67
67
68
- public static void AppendHeader ( StreamWriter writer , ref int identation , string nameSpace , string className ,
68
+ public static void AppendHeader ( StreamWriter writer , ref int identation , string nameSpace , string classAttributes , string className ,
69
69
bool isPartial , bool isStatic , params string [ ] directives )
70
70
{
71
71
writer . WriteLine ( "// Automatically generated" ) ;
@@ -92,6 +92,9 @@ public static void AppendHeader(StreamWriter writer, ref int identation, string
92
92
identation ++ ;
93
93
}
94
94
95
+ if ( ! string . IsNullOrEmpty ( classAttributes ) )
96
+ writer . WriteLine ( $ "{ GetIndentation ( identation ) } { classAttributes } ") ;
97
+
95
98
string finalClassDeclaration = "" ;
96
99
finalClassDeclaration += GetIndentation ( identation ) ;
97
100
finalClassDeclaration += "public " ;
@@ -109,6 +112,43 @@ public static void AppendHeader(StreamWriter writer, ref int identation, string
109
112
110
113
identation ++ ;
111
114
}
115
+
116
+
117
+ public static void AppendHeader ( StreamWriter writer , ref int identation , string nameSpace , string classAttributes , string classDeclaration , params string [ ] directives )
118
+ {
119
+ writer . WriteLine ( "// Automatically generated" ) ;
120
+ writer . WriteLine ( "//" ) ;
121
+ writer . WriteLine ( ) ;
122
+ for ( int i = 0 ; i < directives . Length ; i ++ )
123
+ {
124
+ string directive = directives [ i ] ;
125
+
126
+ if ( string . IsNullOrEmpty ( directive ) )
127
+ continue ;
128
+
129
+ writer . WriteLine ( $ "using { directive } ;") ;
130
+ }
131
+
132
+ writer . WriteLine ( ) ;
133
+
134
+ bool hasNameSpace = ! string . IsNullOrEmpty ( nameSpace ) ;
135
+ if ( hasNameSpace )
136
+ {
137
+ writer . WriteLine ( $ "namespace { nameSpace } ") ;
138
+ writer . WriteLine ( "{" ) ;
139
+
140
+ identation ++ ;
141
+ }
142
+
143
+ if ( ! string . IsNullOrEmpty ( classAttributes ) )
144
+ writer . WriteLine ( $ "{ GetIndentation ( identation ) } { classAttributes } ") ;
145
+
146
+ writer . WriteLine ( $ "{ GetIndentation ( identation ) } { classDeclaration } ") ;
147
+ writer . WriteLine ( GetIndentation ( identation ) + "{" ) ;
148
+
149
+ identation ++ ;
150
+ }
151
+
112
152
113
153
public static void AppendLine ( StreamWriter writer , int identation , string input = "" )
114
154
{
@@ -157,7 +197,7 @@ public static void GenerateStaticCollectionScript(ScriptableObjectCollection col
157
197
directives . Add ( collection . GetType ( ) . Namespace ) ;
158
198
directives . AddRange ( GetCollectionDirectives ( collection ) ) ;
159
199
160
- AppendHeader ( writer , ref indentation , nameSpace ,
200
+ AppendHeader ( writer , ref indentation , nameSpace , "" ,
161
201
collection . GetCollectionType ( ) . Name , true , false , directives . Distinct ( ) . ToArray ( ) ) ;
162
202
163
203
GeneratedStaticFileType staticFileTypeForCollection = ScriptableObjectCollectionSettings . Instance . GetStaticFileTypeForCollection ( collection ) ;
0 commit comments