DOCS: Move hardcoded code examples to testable files - #2472
DOCS: Move hardcoded code examples to testable files#2472ChoshikaBagratee wants to merge 10 commits into
Conversation
|
|
Corrected file path syntax in documentation and improved performance tip.
…ithub.com/Unity-Technologies/InputSystem into docatt-11021-move-hardcoded-code-examples
There was a problem hiding this comment.
💡 Harness Review
The migration consistently redirects the affected manual pages to external source regions, but several of the newly added samples cannot be compiled together in the existing documentation-samples assembly.
Reviewed commit 8a42ed2
🤖 Helpful? 👍/👎
| using UnityEngine; | ||
| using UnityEngine.InputSystem; | ||
|
|
||
| class BindingConflictsExample : InputTestFixture |
There was a problem hiding this comment.
InputTestFixture is not provided by this assembly's only direct reference (Unity.InputSystem): its declaration belongs to the separate Unity.InputSystem.TestFramework assembly. Consequently this sample produces an unresolved-type compiler error in Unity.InputSystem.DocCodeSamples. Either put this test-fixture example in a test assembly that references the framework (with the appropriate test constraints) or avoid using the fixture in this compiled sample.
🤖 Helpful? 👍/👎
| using UnityEngine.InputSystem; | ||
| using UnityEngine.InputSystem.Interactions; | ||
|
|
||
| public class ExampleScript : MonoBehaviour |
There was a problem hiding this comment.
These sources are all compiled into one documentation-samples assembly, so this declares DocCodeSamples.Tests.ExampleScript a second time—the same fully qualified type is already declared in ConfigureInputfromCode.cs. The same change also introduces a duplicate global MyPlayerScript between GenerateCsApiFromActions.cs and UsingDirectWorkflow.cs. C# rejects both duplicate declarations, preventing the entire samples assembly from compiling; give the snippets distinct types or namespaces.
🤖 Helpful? 👍/👎
| // you change the default values for the action map, the name of the interface | ||
| // will be different. | ||
|
|
||
| public class MyPlayerScript : MonoBehaviour, IGameplayActions |
There was a problem hiding this comment.
The sample assembly contains neither IGameplayActions nor MyPlayerControls; the latter is only described in the comments as code the user would generate. This makes the relocated sample fail to compile (and generated callback interfaces are nested under their generated wrapper type). Add an appropriate generated test fixture/stub and implement the nested interface, or exclude this intentionally incomplete snippet from the compiled sample assembly.
🤖 Helpful? 👍/👎
| // controls (For example, "<Gamepad>/<Button>"). | ||
| // NOTE: The unconstrained InputStateHistory class can record changes on controls | ||
| // of different value types. | ||
| var history = new InputStateHistory<Vector2>("<Touchscreen>/primaryTouch/position"); |
There was a problem hiding this comment.
InputStateHistory<TValue> is declared in UnityEngine.InputSystem.LowLevel, but this file imports only UnityEngine.InputSystem. The two examples therefore cannot resolve InputStateHistory and make the samples assembly fail to compile. Add the LowLevel using (or fully qualify the type).
🤖 Helpful? 👍/👎
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #2472 +/- ##
========================================
Coverage 78.95% 78.95%
========================================
Files 767 767
Lines 140780 140780
========================================
Hits 111153 111153
Misses 29627 29627
|
Description
JIRA: DOCATT-11021
Moves some of the code examples into testable files. I did not have time to move all of them.
Testing status & QA
Overall Product Risks
Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.
Comments to reviewers
Checklist
Before review:
Changed,Fixed,Addedsections.Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.