Ver Fonte

Merge pull request #177 from stride3d/master

Testing recent updates in staging
Vaclav Elias há 2 anos atrás
pai
commit
c84f7409ae

+ 4 - 4
BuildDocs.ps1

@@ -87,9 +87,9 @@ function Ask-IncludeAPI {
     Write-Host -ForegroundColor Yellow "  [N] No"
     Write-Host ""
 
-    $input = Read-Host -Prompt "Your choice [Y, N, or ENTER (default is Y)]"
+    $answer = Read-Host -Prompt "Your choice [Y, N, or ENTER (default is Y)]"
 
-    return ($input -eq "Y" -or $input -eq "y" -or $input -eq "")
+    return ($answer -ieq "y" -or $answer -eq "")
 }
 
 function Ask-UseExistingAPI {
@@ -100,9 +100,9 @@ function Ask-UseExistingAPI {
     Write-Host -ForegroundColor Yellow "  [N] No"
     Write-Host ""
 
-    $input = Read-Host -Prompt "Your choice [Y, N, or ENTER (default is Y)]"
+    $answer = Read-Host -Prompt "Your choice [Y, N, or ENTER (default is Y)]"
 
-    return ($input -eq "Y" -or $input -eq "y" -or $input -eq "")
+    return ($answer -ieq "y" -or $answer -eq "")
 }
 
 function Copy-ExtraItems {

+ 1 - 2
en/diagnostics/STRDIAG006.md

@@ -17,7 +17,6 @@ public class STRDIAG006
 {
     // non existent setters count as non visible
     [DataMember(DataMemberMode.Assign)]
-    [DataMember(DataMemberMode.Assign)]
     public int Property1 { get; }
 
     [DataMember(DataMemberMode.Assign)]
@@ -57,4 +56,4 @@ To resolve the warning, increase the accessibility of the properties set to `pub
 
 ## References
 
-- [Serialisation](../manual/scripts/serialization.md)
+- [Serialisation](../manual/scripts/serialization.md)

+ 25 - 4
en/diagnostics/index.md

@@ -1,9 +1,30 @@
 # Stride diagnostics
 
-Some C# compiler errors have corresponding topics that explain why the error is generated, and, in some cases, how to fix the error. Use one of the following steps to see whether help is available for a particular error message.
+Stride.Core.CompilerServices contains Roslyn code analyzers.
 
-[Rule of Thumb Serialization](../manual/scripts/serialization.md#rule-of-thumb)
+> [!IMPORTANT]
+> These analyzers do not perform any kind of telemetry. The same analyzers get used by your IDE when you get a CSXXXX diagnostic.
+
+They analyze the code for possible issues in your project with the Stride.Core design.
+To avoid unexpected runtime/compile time/editor time behaviour these analyzers try to warn as soon as possible for issues that may occur.
+Each of the following pages contain information about diagnostic codes that can be reported by the Roslyn analyzers, which are built into Stride.Core.CompilerServices.
+
+The information covers:
+
+- When is the diagnostics reported
+- An explanation why it is necessary to report the diagnostic
+- Examples when such a diagnostics occurs
+- Information about how to resolve the diagnostic
+
+If an error is reported it is possible to click in the IDE on the `diagnostic code` in the information box about the diagnostic.
+This will open the corresponding information page about the diagnostic.
+
+The Stride.Core.CompilerServices is linked to Stride.Core, the diagnostic Analysis will only occur if your project references Stride.Core in the PackageReferences, this will automatically add the Stride.Core.CompilerServices to your project.
 
 > [!WARNING]
-> Please note that this diagnostic feature is experimental and may not work as expected.
-> Warnings might include solutions that are not yet fully functional.
+> Note that diagnostic feature is experimental and may not work as expected. Warnings may contain solutions that don't work yet.
+
+## References
+
+- [Rule of Thumb Serialization](../manual/scripts/serialization.md#rule-of-thumb)
+- [Serialisation](../manual/scripts/serialization.md)

+ 12 - 1
en/manual/stride-for-godot-developers/index.md

@@ -2,6 +2,17 @@
 
 ## Editor
 
+The Stride editor is **Game Studio**.
+
+![Godot layout](media/stride-vs-godot-godotlayout.webp)
+
+![Stride Game Studio layout](media/stride-vs-godot-stridelayout.webp)
+
+You can customize the Game Studio layout by dragging tabs, similar to Visual Studio.
+
+For more information about Game Studio, see the [Game Studio](../game-studio/index.md) page.
+
+
 ## Terminology
 
 | Godot | Stride |
@@ -9,7 +20,7 @@
 | Scene | Entity Tree |
 | Inspector | Property Grid |
 | FileSystem | Solution/Asset View |
-|Scene view | Scene Editor |
+| Scene view | Scene Editor |
 | Node | Entity |
 | Node Script | SyncScript, AsyncScript, StartupScript |
 | Export | Serialize/DataMember |

+ 3 - 0
en/manual/stride-for-godot-developers/media/stride-vs-godot-godotlayout.webp

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e660bd6c067274031e9edbaab837e3445ec801e23bda168fcd39676a2ede829f
+size 81446

+ 3 - 0
en/manual/stride-for-godot-developers/media/stride-vs-godot-stridelayout.webp

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:677d511085f09acb48b8cd74a9a05f4f7852ea877be7aad9534ffd80666cb84f
+size 73840

+ 83 - 70
en/manual/stride-for-unity-developers/index.md

@@ -8,9 +8,9 @@ Stride and Unity® both use C# and share many concepts, with a few major differe
 
 The Stride editor is **Game Studio**. This is the equivalent of the Unity® Editor.
 
-![Stride and Unity®  interface comparison](media/stride-vs-unity-interface-comparison.png)
+![Unity® Editor layout](media/stride-vs-unity-unitylayout.webp)
 
-*Unity® screenshot taken from [Calling a web-service from a Unity3D scene](http://through-the-interface.typepad.com/through_the_interface/2012/04/calling-a-web-service-from-a-unity3d-scene.html) by Kean Walmsley.*
+![Stride Game Studio layout](media/stride-vs-unity-stridelayout.webp)
 
 You can customize the Game Studio layout by dragging tabs, similar to Visual Studio.
 
@@ -20,22 +20,22 @@ For more information about Game Studio, see the [Game Studio](../game-studio/ind
 
 Unity® and Stride use mostly common terms, with a few differences:
 
-| Unity®          | Stride                                 |
-|-----------------|----------------------------------------|
-| Hierarchy panel | Entity Tree                            |
-| Inspector       | Property Grid                          |
-| Project browser | Asset View                             |
-| Scene view      | Scene Editor                           |
-| GameObject      | Entity                                 |
-| MonoBehaviour   | SyncScript, AsyncScript, StartupScript |
+| Unity®           | Stride                                       |
+|------------------|----------------------------------------------|
+| Hierarchy Window | Entity Tree                                  |
+| Inspector Window | Property Grid                                |
+| Project Window   | Asset View                                   |
+| Scene View       | Scene Editor                                 |
+| [`GameObject`](https://docs.unity3d.com/ScriptReference/GameObject.html) | [`Entity`](xref:Stride.Engine.Entity) |
+| [`MonoBehaviour`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) | [`SyncScript`](xref:Stride.Engine.SyncScript), [`AsyncScript`](xref:Stride.Engine.AsyncScript), [`StartupScript`](xref:Stride.Engine.StartupScript) |
 
 ## Folders and files
 
 Like Unity®, Stride projects are stored in a directory that contains:
 
-* The project ``.sln`` solution file, which you can open with Game Studio or any IDE such as Visual Studio
+* The project `.sln` solution file, which you can open with Game Studio or any IDE such as Visual Studio
 
-* a **MyGame.Game** folder with project source files, dependencies, resources, configurations, and binaries
+* A **MyGame.Game** folder with project source files, dependencies, resources, configurations, and binaries
 
   ![Package folder structure](../files-and-folders/media/folder-structure.png)
 
@@ -45,7 +45,7 @@ Like Unity®, Stride projects are stored in a directory that contains:
 
 * **MyPackage.Game** contains your source code.
 
-*   **MyPackage.Platform** contains additional code for the platforms your project supports. Game Studio creates folders for each platform (e.g. *MyPackage.Windows*, *MyPackage.Linux*, etc.). These folders are usually small and only contain the entry point of the program.
+  * **MyPackage.Platform** contains additional code for the platforms your project supports. Game Studio creates folders for each platform (e.g. *MyPackage.Windows*, *MyPackage.Linux*, etc.). These folders are usually small and only contain the entry point of the program.
 
 * **obj** contains cached files. Game Studio creates this folder when you build your project. To force a complete asset and code rebuild, delete this folder and build the project again.
 
@@ -93,7 +93,7 @@ You can have multiple scenes in your project. The scene that loads up as soon as
 To set the default scene:
 
 1. In the **GameSettings** properties, next to **Default Scene**, click ![Hand icon](~/manual/game-studio/media/hand-icon.png) (**Select an asset**).
-    
+
     ![Set default scene](media/stride-vs-unity-game-settings-default-scene.png)
 
     The **Select an asset** window opens.
@@ -132,6 +132,7 @@ All entities are created with a Transform component by default.
 In Stride, Transform components contain a LocalMatrix and a WorldMatrix that are updated in every Update frame. If you need to force an update sooner than that you can use `TranformComponent.UpdateLocalMatrix()`, `Transform.UpdateWorldMatrix()`, or `Transform.UpdateLocalFromWorld()` to do so, depending on how you need to update the matrix.
 
 #### Local Position/Rotation/Scale
+
 Stride uses position, rotation, and scale to refer to the local position, rotation, and scale.
 
 | Unity®                       | Stride                       |
@@ -142,6 +143,7 @@ Stride uses position, rotation, and scale to refer to the local position, rotati
 | `transform.localEulerAngles` | `Transform.RotationEulerXYZ` |
 
 #### World Position/Rotation/Scale
+
 In comparison to Unity, many of the Transform component's properties related to its location in the world have been moved to the [WorldMatrix](xref:Stride.Engine.TransformComponent.WorldMatrix).
 
 | Unity®                                                            | Stride                                                                                                 |
@@ -158,6 +160,7 @@ In comparison to Unity, many of the Transform component's properties related to
 To ensure you're reading the latest position and rotation, you should force the matrix to update by calling `Transform.UpdateWorldMatrix()` before reading from it.
 
 #### Transform Directions
+
 Unlike Unity, Stride provides a Backward, Left, and Down property.
 Note that those are matrix properties, so setting one of those is not enough to properly rotate the matrix.
 
@@ -218,13 +221,13 @@ As soon as you add an asset to your project, you can edit its properties in the
 
 Like Unity®, Stride supports file formats including:
 
-| Asset type                    | Supported formats                                            |
-|-------------------------------|--------------------------------------------------------------|
-| Models, animations, skeletons | .dae, .3ds, obj, .blend, .x, .md2, .md3, .dxf, .fbx          |
-| Sprites, textures, skyboxes   | .dds, .jpg, .jpeg, .png, .gif, .bmp, .tga, .psd, .tif, .tiff |
-| Audio                         | .wav, .mp3, .ogg, .aac, .aiff, .flac, .m4a, .wma, .mpc       |
-| Fonts                         | .ttf, .otf                                                   |
-| Video                         | .mp4                                                         |
+| Asset type                    | Supported formats                                                                |
+|-------------------------------|----------------------------------------------------------------------------------|
+| Models, animations, skeletons | `.fbx`, `.dae`, `.3ds`, `.obj`, `.blend`, `.x`, `.md2`, `.md3`, `.dxf`           |
+| Sprites, textures, skyboxes   | `.dds`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.bmp`, `.tga`, `.psd`, `.tif`, `.tiff` |
+| Audio                         | `.wav`, `.mp3`, `.ogg`, `.aac`, `.aiff`, `.flac`, `.m4a`, `.wma`, `.mpc`         |
+| Fonts                         | `.ttf`, `.otf`                                                                   |
+| Video                         | `.mp4`                                                                           |
 
 For more information about assets, see [Assets](../game-studio/assets.md).
 
@@ -275,11 +278,12 @@ Stride supports a variety of inputs. The code samples below demonstrate the diff
 For more information about Input in Stride, see [Input](../input/index.md).
 
 #### Unity®
+
 ```cs
 void Update()
 {
     // true for one frame in which the space bar was pressed
-    if(Input.GetKeyDown(KeyCode.Space))
+    if (Input.GetKeyDown(KeyCode.Space))
     {
         // Do something.
     }
@@ -290,17 +294,19 @@ void Update()
         // Do something.
     }
 
-    float Horiz = Input.GetAxis("Horizontal");
-    float Vert = Input.GetAxis("Vertical");
-    //Do something else.
+    float horiz = Input.GetAxis("Horizontal");
+    float vert = Input.GetAxis("Vertical");
+    // Do something else.
 }
 ```
+
 #### Stride
+
 ```cs
 public override void Update()
 {
     // true for one frame in which the space bar was pressed
-    if(Input.IsKeyDown(Keys.Space))
+    if (Input.IsKeyDown(Keys.Space))
     {
         // Do something.
     }
@@ -311,9 +317,9 @@ public override void Update()
         // Do something.
     }
 
-    float Horiz = (Input.IsKeyDown(Keys.Left) ? -1f : 0) + (Input.IsKeyDown(Keys.Right) ? 1f : 0);
-    float Vert = (Input.IsKeyDown(Keys.Down) ? -1f : 0) + (Input.IsKeyDown(Keys.Up) ? 1f : 0);
-    //Do something else.
+    float horiz = (Input.IsKeyDown(Keys.Left) ? -1f : 0) + (Input.IsKeyDown(Keys.Right) ? 1f : 0);
+    float vert = (Input.IsKeyDown(Keys.Down) ? -1f : 0) + (Input.IsKeyDown(Keys.Up) ? 1f : 0);
+    // Do something else.
 }
 ```
 
@@ -342,22 +348,27 @@ They're controlled by scripts in slightly different ways.
 #### Unity®
 
 ```cs
-public Rigidbody rigidBody;
-void Start()
+public class KinematicX : MonoBehaviour
 {
-    rigidBody = GetComponent<Rigidbody>();
-}
+    public Rigidbody rigidBody;
 
-void EnableRagdoll()
-{
-    rigidBody.isKinematic = false;
-    rigidBody.detectCollisions = true;
-}
+    void Start()
+    {
+        // Initialization of the component.
+        rigidBody = GetComponent<Rigidbody>();
+    }
 
-void DisableRagdoll()
-{
-    rigidBody.isKinematic = true;
-    rigidBody.detectCollisions = false;
+    void EnableRagdoll()
+    {
+        rigidBody.isKinematic = false;
+        rigidBody.detectCollisions = true;
+    }
+
+    void DisableRagdoll()
+    {
+        rigidBody.isKinematic = true;
+        rigidBody.detectCollisions = false;
+    }
 }
 ```
 
@@ -366,28 +377,29 @@ void DisableRagdoll()
 ```cs
 public class KinematicX : SyncScript
 {
-    public RigidbodyComponent component;
+    public RigidbodyComponent rigidBody;
 
     public override void Start()
     {
-        // Initialization of the script.
-        component = Entity.Get<RigidbodyComponent>();
+        // Initialization of the component.
+        rigidBody = Entity.Get<RigidbodyComponent>();
     }
 
     public override void Update()
     {
+        // Perform an update every frame.
     }
 
-    public void EnableRagdoll()
+    void EnableRagdoll()
     {
-        component.IsKinematic = false;
-        component.ProcessCollisions = true;
+        rigidBody.IsKinematic = false;
+        rigidBody.ProcessCollisions = true;
     }
 
-    public void DisableRagdoll()
+    void DisableRagdoll()
     {
-        component.IsKinematic = true;
-        component.ProcessCollisions = false;
+        rigidBody.IsKinematic = true;
+        rigidBody.ProcessCollisions = false;
     }
 }
 ```
@@ -449,7 +461,7 @@ For more information about triggers in Stride, see [Triggers](../physics/trigger
 #### Unity®
 
 ```cs
-Collider FindGOCameraIsLookingAt()
+public static Collider FindGOCameraIsLookingAt()
 {
     int distance = 50;
 
@@ -491,6 +503,7 @@ public static bool ScreenPositionToWorldPositionRaycast(Vector2 screenPos, Camer
     return result.Succeeded;
 }
 ```
+
 For more information about Raycasting in Stride, see [Raycasting](../physics/raycasting.md).
 
 ## Scripts
@@ -547,7 +560,7 @@ public class BasicMethods : AsyncScript
     // Declared public member fields and properties that will appear in the game studio
     public override async Task Execute()
     {
-        while(Game.IsRunning)
+        while (Game.IsRunning)
         {
             // Do stuff every new frame
             await Script.NextFrame();
@@ -589,19 +602,19 @@ To create a script, click the **Add asset** button and select **Scripts**.
 
 ![Create script in Stride](media/stride-vs-unity-create-script.png)
 
-In Unity®, when you create a `MonoBehaviour` script, it has two base functions: `Start()` and `Update()`. Stride has a [SyncScript](xref:Stride.Engine.SyncScript) that works similarly. Like `MonoBehaviour`, [SyncScript](xref:Stride.Engine.SyncScript) has two methods:
+In Unity®, when you create a [`MonoBehaviour`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html) script, it has two base functions: [`MonoBehaviour.Start()`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html) and [`MonoBehaviour.Update()`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.Update.html). Stride has a [`SyncScript`](xref:Stride.Engine.SyncScript) that works similarly. Like [`MonoBehaviour`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html), [`SyncScript`](xref:Stride.Engine.SyncScript) has two methods:
 
-* [Start()](xref:Stride.Engine.StartupScript.Start) is called when it the script is loaded.
+* [`SyncScript.Start()`](xref:Stride.Engine.StartupScript.Start) is called when it the script is loaded.
 
-* [Update()](xref:Stride.Engine.SyncScript.Update) is called every update.
+* [`SyncScript.Update()`](xref:Stride.Engine.SyncScript.Update) is called every update.
 
-Unlike `MonoBehaviour`, you have to use [Update()](xref:Stride.Engine.SyncScript.Update) method in every [SyncScript](xref:Stride.Engine.SyncScript), or your code won't work properly.
+Unlike [`MonoBehaviour`](https://docs.unity3d.com/ScriptReference/MonoBehaviour.html), implementating the [`SyncScript.Update()`](xref:Stride.Engine.SyncScript.Update) method is not optional, and as such, must be implemented in every [`SyncScript`](xref:Stride.Engine.SyncScript).
 
 If you want your script to be a startup or asynchronous, use the corresponding script types:
 
-* [StartupScript](xref:Stride.Engine.StartupScript): this script has a single [Start()](xref:Stride.Engine.StartupScript.Start) method. It initializes the scene and its content at startup.
+* [`StartupScript`](xref:Stride.Engine.StartupScript): this script has a single [`StartupScript.Start()`](xref:Stride.Engine.StartupScript.Start) method. It initializes the scene and its content at startup.
 
-* [AsyncScript](xref:Stride.Engine.AsyncScript): an asynchronous script with a single method [Execute()](xref:Stride.Engine.AsyncScript.Execute) and you can use async/await inside that method. Asynchronous scripts aren't loaded one by one like synchronous scripts. Instead, they're all loaded in parallel.
+* [`AsyncScript`](xref:Stride.Engine.AsyncScript): an asynchronous script with a single method [`AsyncScript.Execute()`](xref:Stride.Engine.AsyncScript.Execute) and you can use async/await inside that method. Asynchronous scripts aren't loaded one by one like synchronous scripts. Instead, they're all loaded in parallel.
 
 ### Reload assemblies
 
@@ -640,8 +653,8 @@ public Quaternion SpawnRotation;
 
 void Start()
 {
-    GameObject NewGO = (GameObject)Instantiate(CarPrefab, SpawnPosition, SpawnRotation);
-    NewGO.name = "NewGameObject1";
+    GameObject newGameObject = (GameObject)Instantiate(CarPrefab, SpawnPosition, SpawnRotation);
+    newGameObject.name = "NewGameObject1";
 }
 ```
 
@@ -674,15 +687,15 @@ Each class in Unity® has certain default values. If you don't override these pr
 
 ```cs
 public int NewProp = 30;
-public Light MyLightComp = null;
+public Light MyLightComponent = null;
 
 void Start()
 {
     // Create the light component if we don't already have one.
-    if (MyLightComp == null)
+    if (MyLightComponent == null)
     {
-        MyLightComp = gameObject.AddComponent<Light>();
-        MyLightComp.intensity = 3;
+        MyLightComponent = gameObject.AddComponent<Light>();
+        MyLightComponent.intensity = 3;
     }
 }
 ```
@@ -739,13 +752,13 @@ LightComponent lightComponent = Entity.Get<LightComponent>();
 #### Unity®
 
 ```cs
-GameObject ParentGO = lightComponent.gameObject;
+GameObject componentGameObject = lightComponent.gameObject;
 ```
 
 #### Stride
 
 ```cs
-Entity ParentEntity = lightComponent.Entity;
+Entity componentEntity = lightComponent.Entity;
 ```
 
 ## Log output
@@ -758,10 +771,10 @@ Game Studio displays in the **Output** tab (at the bottom of Game Studio by defa
 
 ![Output tab](media/output-tab.png)
 
-
 ### Print debug messages
 
 Logging from a ScriptComponent:
+
 ```cs
 public override void Start()
 {
@@ -792,9 +805,9 @@ System.Diagnostics.Debug.WriteLine("hello");
 | `[Tooltip("My tooltip")]` | `/// <userdoc>My tooltip</userdoc>` |
 
 >[!Note]
->You cannot serialize private fields in Stride, if you want to set a field in editor but prevent other scripts from writing to that field, you should use a [init property](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/init)
+>You cannot serialize `private` fields in Stride, if you want to set a field in editor but prevent other scripts from writing to that field, you should use a [init property](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/init)
 
-```cs 
+```cs
 public float MyProperty { get; init; }
 ```
 

+ 0 - 3
en/manual/stride-for-unity-developers/media/stride-vs-unity-interface-comparison.png

@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:bfce3d618e18e030ab7c191e605c017a11ca84b81bf958d01ab68a03b9f5f141
-size 518009

+ 3 - 0
en/manual/stride-for-unity-developers/media/stride-vs-unity-stridelayout.webp

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:677d511085f09acb48b8cd74a9a05f4f7852ea877be7aad9534ffd80666cb84f
+size 73840

+ 3 - 0
en/manual/stride-for-unity-developers/media/stride-vs-unity-unitylayout.webp

@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f2d2c7e64a291e191b7cb7998c36d3ccd5b598206a105c9c7a959a8ebaf4b2a6
+size 78284

+ 2 - 2
en/manual/ui/ui-libraries.md

@@ -50,7 +50,7 @@ public Button CreateButton()
     if (button != null)
     {        
         // attach a delegate to the Click event
-        someButton.Click += delegate
+        button.Click += delegate
         {
             // do something here...
         };
@@ -67,4 +67,4 @@ UI pages have only one root element. UI libraries can have multiple root element
 * [UI pages](ui-pages.md)
 * [UI editor](ui-editor.md)
 * [Add a UI to a scene](add-a-ui-to-a-scene.md)
-* [Layout system](layout-system.md)
+* [Layout system](layout-system.md)

+ 1 - 1
jp/manual/ui/ui-libraries.md

@@ -100,7 +100,7 @@ public Button CreateButton()
     {        
         // Click イベントにデリゲートを登録します。
         // attach a delegate to the Click event
-        someButton.Click += delegate
+        button.Click += delegate
         {
             // ここで何かの作業をします。
             // do something here...