Browse Source

Merge branch 'stride3d:master' into master

Vaclav Elias 2 years ago
parent
commit
28e5e141ba

+ 2 - 2
en/manual/scripts/debugging.md

@@ -5,8 +5,8 @@
 
 
 If your script isn't producing the expected result at runtime, you can debug it in an IDE such as Visual Studio.
 If your script isn't producing the expected result at runtime, you can debug it in an IDE such as Visual Studio.
 
 
->[!Note]
->[There are lots of ways to debug code. This page suggests one method, using Visual Studio.]
+> [!Note]
+> There are lots of ways to debug code. This page suggests one method, using Visual Studio.
 
 
 1. Open the script in Visual Studio.
 1. Open the script in Visual Studio.
 
 

+ 0 - 1
en/manual/scripts/preprocessor-variables.md

@@ -33,7 +33,6 @@ If you're developing for multiple platforms, you often need to write custom code
 ## Example
 ## Example
 
 
 ```cs
 ```cs
-
 #if STRIDE_PLATFORM_WINDOWS
 #if STRIDE_PLATFORM_WINDOWS
     // Windows-specific code goes here...
     // Windows-specific code goes here...
 
 

+ 47 - 44
en/manual/scripts/public-properties-and-fields.md

@@ -31,25 +31,26 @@ Game Studio shows the `DelayTimeOut` property in the script component properties
 >[!Note]
 >[!Note]
 >As a general rule, if you want to display the property or field in Game Studio, getters and setters should do as little as possible. For example, they shouldn't try to call methods or access Stride runtime API.
 >As a general rule, if you want to display the property or field in Game Studio, getters and setters should do as little as possible. For example, they shouldn't try to call methods or access Stride runtime API.
 
 
->For example, the following code will create problems, as it tries to access `Entity.Components`, which is only available at runtime:
-
->```cs
->public class SampleSyncScript : StartupScript
->{
->	private float delayTimeOut;
->	// This public member will appear in Game Studio
->	public float DelayTimeOut
->	{
->		get { return delayTimeOut; }
->		set
->		{ 
->			delayTimeOut = value;
->			Entity.Components.Add(new SkyboxComponent());
->		}
->	}
->}
->```
->If you want to include code like this in a property or field, hide it so Game Studio doesn't display it (see below). 
+For example, the following code will create problems, as it tries to access `Entity.Components`, which is only available at runtime:
+
+```cs
+public class SampleSyncScript : StartupScript
+{
+	private float delayTimeOut;
+	// This public member will appear in Game Studio
+	public float DelayTimeOut
+	{
+		get { return delayTimeOut; }
+		set
+		{ 
+			delayTimeOut = value;
+			Entity.Components.Add(new SkyboxComponent());
+		}
+	}
+}
+```
+
+If you want to include code like this in a property or field, hide it so Game Studio doesn't display it (see below). 
 
 
 ## Hide properties or fields in the Property Grid
 ## Hide properties or fields in the Property Grid
 
 
@@ -59,10 +60,9 @@ If you don't want Game Studio to show a property in the Property Grid, you can:
 * use the [DataMemberIgnore](xref:Stride.Core.DataMemberIgnoreAttribute) attribute like this:
 * use the [DataMemberIgnore](xref:Stride.Core.DataMemberIgnoreAttribute) attribute like this:
 
 
 ```cs
 ```cs
-
-	// This public property isn't available in Game Studio
-	[DataMemberIgnore]
-	public float DelayTimeOut { get; set; }
+// This public property isn't available in Game Studio
+[DataMemberIgnore]
+public float DelayTimeOut { get; set; }
 	
 	
 ```
 ```
 
 
@@ -75,22 +75,22 @@ Game Studio no longer shows the property:
 When you add a `<userdoc>` comment block above your public property in code, Game Studio will display it in the description field.
 When you add a `<userdoc>` comment block above your public property in code, Game Studio will display it in the description field.
 
 
 ```cs
 ```cs
-	///<summary>
-	/// This summary won't show in Game Studio
-	///</summary>
-	///<userdoc>
-	/// This description will show in Game Studio
-	///</userdoc>
-	public float DelayTimeOut { get; set; }
+///<summary>
+/// This summary won't show in Game Studio
+///</summary>
+///<userdoc>
+/// This description will show in Game Studio
+///</userdoc>
+public float DelayTimeOut { get; set; }
 
 
 ```
 ```
 
 
 Enable documentation file generation:
 Enable documentation file generation:
 ```xml
 ```xml
-  <PropertyGroup>
-    <TargetFrameworks>net6.0</TargetFrameworks>
-    <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
-  </PropertyGroup>
+<PropertyGroup>
+  <TargetFrameworks>net6.0</TargetFrameworks>
+  <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
+</PropertyGroup>
 ```
 ```
 
 
 > [!NOTE]
 > [!NOTE]
@@ -100,20 +100,23 @@ On next reload, the Game Studio should display the documentation:
 
 
 ![The description now shows in the Property Grid](media/userdoc-example.png)
 ![The description now shows in the Property Grid](media/userdoc-example.png)
 
 
-## [MemberRequiredAttribute](xref:Stride.Core.Annotations.MemberRequiredAttribute)
-This attribute is used to specify if a field or property should not be left null in editor.
-If no values are set for this member, a warning or error will be logged when building your game.
+## MemberRequiredAttribute
+The [`MemberRequiredAttribute`](xref:Stride.Core.Annotations.MemberRequiredAttribute) is used to specify if a field or property should not be left null in the editor. If no values are set for this member, a warning or error will be logged when building your game.
+
+
 ```cs
 ```cs
 [Stride.Core.Annotations.MemberRequired(MemberRequiredReportType.Error)] public CharacterComponent MyCharacter;
 [Stride.Core.Annotations.MemberRequired(MemberRequiredReportType.Error)] public CharacterComponent MyCharacter;
 ```
 ```
 
 
-#### [DataMemberRangeAttribute](xref:Stride.Core.Annotations.DataMemberRangeAttribute)
-#### [InlinePropertyAttribute](xref:Stride.Core.Annotations.InlinePropertyAttribute)
-#### [ItemCanBeNullAttribute](xref:Stride.Core.Annotations.ItemCanBeNullAttribute)
-#### [ItemNotNullAttribute](xref:Stride.Core.Annotations.ItemNotNullAttribute)
-#### [MemberCollectionAttribute](xref:Stride.Core.Annotations.MemberCollectionAttribute)
-#### [DataStyleAttribute](xref:Stride.Core.DataStyleAttribute)
-#### [DisplayAttribute](xref:Stride.Core.DisplayAttribute)
+## Additional Serialization Attributes
+
+- [`DataMemberRangeAttribute`](xref:Stride.Core.Annotations.DataMemberRangeAttribute)
+- [`InlinePropertyAttribute`](xref:Stride.Core.Annotations.InlinePropertyAttribute)
+- [`ItemCanBeNullAttribute`](xref:Stride.Core.Annotations.ItemCanBeNullAttribute)
+- [`ItemNotNullAttribute`](xref:Stride.Core.Annotations.ItemNotNullAttribute)
+- [`MemberCollectionAttribute`](xref:Stride.Core.Annotations.MemberCollectionAttribute)
+- [`DataStyleAttribute`](xref:Stride.Core.DataStyleAttribute)
+- [`DisplayAttribute`](xref:Stride.Core.DisplayAttribute)
 
 
 ## See also
 ## See also
 
 

+ 17 - 15
en/manual/scripts/serialization.md

@@ -1,13 +1,13 @@
-# Serialization
+# Serialization
 
 
 <span class="badge text-bg-primary">Beginner</span>
 <span class="badge text-bg-primary">Beginner</span>
 <span class="badge text-bg-success">Programmer</span>
 <span class="badge text-bg-success">Programmer</span>
 
 
 The editor and serialization system uses four attributes to determine what is serialized and visible in the editor.
 The editor and serialization system uses four attributes to determine what is serialized and visible in the editor.
 
 
-### [DataContractAttribute](xref:Stride.Core.DataContractAttribute)
-Adding this attribute to your `class` or `struct` notifies the serializer and the editor that it should
-show fields and properties of that type, and serialize the data it contains with the scenes or assets that might include it.
+### DataContractAttribute
+Adding the [`DataContractAttribute`](xref:Stride.Core.DataContractAttribute) to your `class` or `struct` notifies the serializer that it should serialize the data it contains, and the editor that it should display fields and properties of that type, along with the scenes or assets that might include it.
+
 ```cs
 ```cs
 [Stride.Core.DataContract(Inherited = true)]
 [Stride.Core.DataContract(Inherited = true)]
 public class MySerializedClass
 public class MySerializedClass
@@ -27,11 +27,9 @@ public class MyDerivedSerializedClass : MySerializedClass
 > They are not interchangeable.
 > They are not interchangeable.
 > Make sure that your `DataContract` comes from `Stride.Core`, specifying the namespace explicitly like shown above if necessary.
 > Make sure that your `DataContract` comes from `Stride.Core`, specifying the namespace explicitly like shown above if necessary.
 
 
-### [DataMemberAttribute](xref:Stride.Core.DataMemberAttribute)
-This notifies the editor and serializer that the property or field on this [DataContract](#datacontractattribute)'ed
-`class` or `struct` should be serialized.
-Note that you can omit this attribute for most public fields and properties, they will be included by default,
-see [Fields](#fields) and [Properties](#properties) for specifics.
+### DataMemberAttribute
+The [`DataMemberAttribute`](xref:Stride.Core.DataMemberAttribute) notifies the editor and serializer that the property or field on this [`DataContract`](#datacontractattribute)'ed `class` or `struct` should be serialized. Note that you can omit this attribute for most public fields and properties, as they will be included by default. See [Fields](#fields) and [Properties](#properties) for specifics.
+
 ```cs
 ```cs
 [Stride.Core.DataContract]
 [Stride.Core.DataContract]
 public class MySerializedClass
 public class MySerializedClass
@@ -41,18 +39,22 @@ public class MySerializedClass
 }
 }
 ```
 ```
 
 
-### [DataAliasAttribute](xref:Stride.Core.DataAliasAttribute)
-Can be used to ensure you do not break previously serialized data whenever you have to change how that member is named in your source.
+### DataAliasAttribute
+The [`DataAliasAttribute`](xref:Stride.Core.DataAliasAttribute) can be used to ensure you do not break previously serialized data whenever you have to change how that member is named in your source.
+
 ```cs
 ```cs
 [Stride.Core.DataAlias("PreviousNameOfProp")]
 [Stride.Core.DataAlias("PreviousNameOfProp")]
 public string MyRenamedProp { get; set; }
 public string MyRenamedProp { get; set; }
 ```
 ```
+
 > [!Note]
 > [!Note]
 > Alias remaps values only while in the editor; this feature is specific to the YAML serialization system. Alias will be ignored during builds and at runtime.
 > Alias remaps values only while in the editor; this feature is specific to the YAML serialization system. Alias will be ignored during builds and at runtime.
 
 
-### [DataMemberIgnoreAttribute](xref:Stride.Core.DataMemberIgnoreAttribute)
-This notifies the editor and serializer that the property or field on this [DataContract](#datacontractattribute)'ed
-`class` or `struct` should ***NOT*** be serialized.
+### DataMemberIgnoreAttribute
+
+The [`DataMemberIgnoreAttribute`](xref:Stride.Core.DataMemberIgnoreAttribute) notifies the editor and serializer that the property or field on this [`DataContract`](#datacontractattribute)'ed `class` or `struct` should ***NOT*** be serialized.
+
+
 ```cs
 ```cs
 [Stride.Core.DataContract]
 [Stride.Core.DataContract]
 public class MySerializedClass
 public class MySerializedClass
@@ -67,7 +69,7 @@ public class MySerializedClass
 - [DataMemberUpdatableAttribute](xref:Stride.Updater.DataMemberUpdatableAttribute)
 - [DataMemberUpdatableAttribute](xref:Stride.Updater.DataMemberUpdatableAttribute)
 
 
 ## Rule of Thumb
 ## Rule of Thumb
-Serialization and the editor's access and view of your properties mirrors how access modifiers work in C#;
+Serialization and the editor's access and view of your properties mirrors how access modifiers work in C#.
 
 
 Think of the serializer/editor as being a class external to your codebase, if you want the serializer to
 Think of the serializer/editor as being a class external to your codebase, if you want the serializer to
 read and write your properties you have to ensure that the access modifiers for its getter and setter
 read and write your properties you have to ensure that the access modifiers for its getter and setter

+ 10 - 10
en/manual/scripts/use-a-script.md

@@ -56,16 +56,16 @@ Game Studio adds an entity to your scene, with the script as a component on the
 >[!Note]
 >[!Note]
 >You can customize where scripts appear in the dropdown using the `ComponentCategoryAttribute`:
 >You can customize where scripts appear in the dropdown using the `ComponentCategoryAttribute`:
 
 
->```cs
->[ComponentCategory("My Startup Scripts")]
->public class SampleStartupScript : StartupScript
->{
->    public override void Start()
->    {
->        // Do some stuff during initialization
->    }
->}
->```
+```cs
+[ComponentCategory("My Startup Scripts")]
+public class SampleStartupScript : StartupScript
+{
+    public override void Start()
+    {
+        // Do some stuff during initialization
+    }
+}
+```
 
 
 ## Add a script from code
 ## Add a script from code