浏览代码

Move pushblock with input system integration into the Project. (#5179)

/check-for-ModelOverriders
GitHub 4 年前
当前提交
07926a18
共有 42 个文件被更改,包括 1148 次插入63 次删除
  1. 7
      Project/Packages/manifest.json
  2. 56
      Project/Packages/packages-lock.json
  3. 2
      Project/ProjectSettings/ProjectSettings.asset
  4. 2
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs.meta
  5. 20
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs/PushBlockWithInputArea.prefab
  6. 2
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs/PushBlockWithInputArea.prefab.meta
  7. 2
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/PushBlockActions.inputactions.meta
  8. 2
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scenes.meta
  9. 2
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts.meta
  10. 4
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs
  11. 23
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputAgentBasic.cs
  12. 10
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputPlayerController.cs
  13. 2
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputSettings.cs
  14. 2
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs.meta
  15. 2
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockActions.cs
  16. 8
      Project/Assets/ML-Agents/Examples/PushBlockWithInput.meta
  17. 1001
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scenes/PushBlockWithInput.unity
  18. 9
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scenes/PushBlockWithInput.unity.meta
  19. 8
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/TFModels.meta
  20. 11
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputAgentBasic.cs.meta
  21. 11
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputSettings.cs.meta
  22. 13
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetect.cs.meta
  23. 12
      Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushAgentBasic.cs.meta
  24. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs.meta
  25. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs
  26. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs/PushBlockWithInputArea.prefab
  27. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs/PushBlockWithInputArea.prefab.meta
  28. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/PushBlockActions.inputactions
  29. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/PushBlockActions.inputactions.meta
  30. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scenes.meta
  31. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts.meta
  32. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts
  33. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputPlayerController.cs.meta
  34. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs
  35. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputAgentBasic.cs
  36. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputPlayerController.cs
  37. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputSettings.cs
  38. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs.meta
  39. 0
      /Project/Assets/ML-Agents/Examples/PushBlockWithInput/TFModels

7
Project/Packages/manifest.json


{
"dependencies": {
"com.unity.ide.rider": "3.0.5",
"com.unity.inputsystem": "1.1.0-preview.3",
"com.unity.toolchain.macos-x86_64-linux-x86_64": "0.1.20-preview",
"com.unity.modules.uielements": "1.0.0",
"com.unity.ml-agents.extensions"
"com.unity.ml-agents.extensions",
"com.unity.inputsystem"
]
}

56
Project/Packages/packages-lock.json


"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.ide.rider": {
"version": "3.0.5",
"depth": 0,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.inputsystem": {
"version": "1.1.0-preview.3",
"depth": 0,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.mathematics": {
"version": "1.2.1",
"depth": 3,

"dependencies": {
"com.unity.barracuda": "1.3.2-preview",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.physics2d": "1.0.0"
"com.unity.modules.jsonserialize": "1.0.0"
}
},
"com.unity.ml-agents.extensions": {

"dependencies": {
"com.unity.ml-agents": "2.0.0-exp.1"
"com.unity.ml-agents": "2.0.0-exp.1",
"com.unity.modules.physics": "1.0.0"
}
},
"com.unity.nuget.newtonsoft-json": {

"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.sysroot": {
"version": "0.1.19-preview",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.sysroot.linux-x86_64": {
"version": "0.1.14-preview",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.sysroot": "0.1.18-preview"
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.22",
"depth": 0,

"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.toolchain.macos-x86_64-linux-x86_64": {
"version": "0.1.20-preview",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.sysroot": "0.1.19-preview",
"com.unity.sysroot.linux-x86_64": "0.1.14-preview"
},
"url": "https://packages.unity.com"
},

"depth": 1,
"source": "builtin",
"dependencies": {}
},
"com.unity.modules.uielements": {
"version": "1.0.0",
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
}
},
"com.unity.modules.unityanalytics": {
"version": "1.0.0",

2
Project/ProjectSettings/ProjectSettings.asset


projectName:
organizationId:
cloudEnabled: 0
enableNativePlatformBackendsForNewInputSystem: 0
enableNativePlatformBackendsForNewInputSystem: 1
disableOldInputManagerSupport: 0
legacyClampBlendShapeWeights: 1

2
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs.meta


fileFormatVersion: 2
guid: 3d2b9d5547d934200a786212743850c4
guid: 99d8483ab96df49fc8909b8d974499e1
folderAsset: yes
timeCreated: 1514922259
licenseType: Free

20
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs/PushBlockWithInputArea.prefab


m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
- {fileID: 2100000, guid: f731be6866ce749fd8349e67ae81f76a, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0

m_Component:
- component: {fileID: 4006990431719496}
m_Layer: 0
m_Name: PushBlockArea
m_Name: PushBlockWithInputArea
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
- {fileID: 2100000, guid: f731be6866ce749fd8349e67ae81f76a, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0

- component: {fileID: 4188187884171146}
- component: {fileID: 54817351390947638}
- component: {fileID: 114306175693660464}
- component: {fileID: 114505490781873732}
- component: {fileID: 1929062229609328833}
- component: {fileID: 65880096262939968}
- component: {fileID: 114807072692257076}
- component: {fileID: 114451319691753174}

m_UseChildSensors: 1
m_UseChildActuators: 1
m_ObservableAttributeHandling: 0
--- !u!114 &114505490781873732
--- !u!114 &1929062229609328833
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dea8c4f2604b947e6b7b97750dde87ca, type: 3}
m_Script: {fileID: 11500000, guid: 925dd654260d9400ea7c46c3fccbc885, type: 3}
m_Name:
m_EditorClassIdentifier:
agentParameters:

- component: {fileID: 65500237382738106}
- component: {fileID: 23965303024756010}
- component: {fileID: 54485094479975724}
- component: {fileID: 114274385944737294}
- component: {fileID: 4489253887773211256}
m_Layer: 0
m_Name: Block
m_TagString: block

m_Interpolate: 0
m_Constraints: 112
m_CollisionDetection: 0
--- !u!114 &114274385944737294
--- !u!114 &4489253887773211256
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}

m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7d079d09ceed84ff49cf6841c66cf7ec, type: 3}
m_Script: {fileID: 11500000, guid: ec55820c897dd4f41904e8c43085f56b, type: 3}
m_Name:
m_EditorClassIdentifier:
agent: {fileID: 0}

m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 0}
- {fileID: 2100000, guid: f731be6866ce749fd8349e67ae81f76a, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0

2
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs/PushBlockWithInputArea.prefab.meta


fileFormatVersion: 2
guid: 03bcc81e249714a22bb411dddcc5d15e
guid: 63400cd020a2d4610832abc15d5adf68
timeCreated: 1515023875
licenseType: Free
NativeFormatImporter:

2
Project/Assets/ML-Agents/Examples/PushBlockWithInput/PushBlockActions.inputactions.meta


assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 1
wrapperCodePath: Assets/ML-Agents/Examples/PushBlock/Scripts/PushBlockActions.cs
wrapperCodePath: Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockActions.cs
wrapperClassName:
wrapperCodeNamespace:

2
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scenes.meta


fileFormatVersion: 2
guid: 9da26ec059778432080bf5fa24374960
guid: 4655b85b9047b42e0b35f79c9245b65a
folderAsset: yes
timeCreated: 1516234013
licenseType: Free

2
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts.meta


fileFormatVersion: 2
guid: ca44e3d53154a4ff0a1279be30b23bdf
guid: 5fb02fbf46767439f8a1483bc12e80de
folderAsset: yes
timeCreated: 1514922284
licenseType: Free

4
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs


using UnityEngine;
public class GoalDetect : MonoBehaviour
public class GoalDetectWithInput : MonoBehaviour
{
/// <summary>
/// The associated agent.

[HideInInspector]
public PushAgentBasic agent; //
public PushBlockWithInputAgentBasic agent; //
void OnCollisionEnter(Collision col)
{

23
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputAgentBasic.cs


using Unity.MLAgents.Actuators;
using Random = UnityEngine.Random;
public class PushAgentBasic : Agent
public class PushBlockWithInputAgentBasic : Agent
{
/// <summary>
/// The ground. The bounds are used to spawn the elements.

/// <summary>
/// The area bounds.
/// </summary>
/// </summary'PushAgentBasic'>
PushBlockSettings m_PushBlockSettings;
PushBlockWithInputSettings m_PushBlockSettings;
/// <summary>
/// The block to be pushed to the goal.

/// Detects when the block touches the goal.
/// </summary>
[HideInInspector]
public GoalDetect goalDetect;
public GoalDetectWithInput goalDetect;
Rigidbody m_BlockRb; //cached on initialization
Rigidbody m_AgentRb; //cached on initialization
Rigidbody m_BlockRb; //cached on initialization
Rigidbody m_AgentRb; //cached on initialization
Material m_GroundMaterial; //cached on Awake()
/// <summary>

void Awake()
{
m_PushBlockSettings = FindObjectOfType<PushBlockSettings>();
m_PushBlockSettings = FindObjectOfType<PushBlockWithInputSettings>();
goalDetect = block.GetComponent<GoalDetect>();
goalDetect = block.GetComponent<GoalDetectWithInput>();
// Starting material
m_GroundMaterial = m_GroundRenderer.material;
}

{
foundNewSpawnLocation = true;
}
return randomSpawnPos;
}

public void SetBlockProperties()
{
var scale = m_ResetParams.GetWithDefault("block_scale", 2);
//Set the scale of the block
m_BlockRb.transform.localScale = new Vector3(scale, 0.75f, scale);

10
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputPlayerController.cs


/// need to share the instance of the generated C# <see cref="IInputActionCollection2"/> (named <see cref="m_PushBlockActions"/>
/// here) in order to ensure that all of your actions are bound correctly for ml-agents training and inference.
/// </summary>
public class PushBlockPlayerController : MonoBehaviour, IInputActionAssetProvider
public class PushBlockWithInputPlayerController : MonoBehaviour, IInputActionAssetProvider
PushBlockSettings m_PushBlockSettings;
PushBlockWithInputSettings m_PushBlockSettings;
Rigidbody m_PlayerRb; //cached on initialization
Rigidbody m_PlayerRb; //cached on initialization
m_PushBlockSettings = FindObjectOfType<PushBlockSettings>();
m_PushBlockSettings = FindObjectOfType<PushBlockWithInputSettings>();
LazyInitializeActions();
// Cache the agent rigidbody

{
return;
}
m_PushBlockActions = new PushBlockActions();
m_PushBlockActions.Enable();

{
m_PlayerRb.AddForce(-transform.up * (m_PushBlockSettings.agentJumpForce * 3), ForceMode.Acceleration);
}
m_JumpTimeRemaining -= Time.fixedDeltaTime;
}

2
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputSettings.cs


using UnityEngine;
public class PushBlockSettings : MonoBehaviour
public class PushBlockWithInputSettings : MonoBehaviour
{
/// <summary>
/// The "walking speed" of the agents in the scene.

2
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs.meta


fileFormatVersion: 2
guid: e5ed63dbfa25542ecb8bc013adfba183
guid: ec55820c897dd4f41904e8c43085f56b
MonoImporter:
externalObjects: {}
serializedVersion: 2

2
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockActions.cs


// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.1.0
// from Assets/ML-Agents/Examples/PushBlock/PushBlockActions.inputactions
// from Assets/ML-Agents/Examples/PushBlockWithInput/PushBlockActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.

8
Project/Assets/ML-Agents/Examples/PushBlockWithInput.meta


fileFormatVersion: 2
guid: e396da2b7dbae4365a9fbd6cf999c9bc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

1001
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scenes/PushBlockWithInput.unity
文件差异内容过多而无法显示
查看文件

9
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scenes/PushBlockWithInput.unity.meta


fileFormatVersion: 2
guid: 0ba15da26c0684ac386bc3da3183d136
timeCreated: 1506808980
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Project/Assets/ML-Agents/Examples/PushBlockWithInput/TFModels.meta


fileFormatVersion: 2
guid: a366d37ea73e9425f82ef8241ee292d5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

11
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputAgentBasic.cs.meta


fileFormatVersion: 2
guid: 925dd654260d9400ea7c46c3fccbc885
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputSettings.cs.meta


fileFormatVersion: 2
guid: 81aead8ba5af44598b1b5296780e489e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

13
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetect.cs.meta


fileFormatVersion: 2
guid: 7d079d09ceed84ff49cf6841c66cf7ec
timeCreated: 1513645763
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

12
Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushAgentBasic.cs.meta


fileFormatVersion: 2
guid: dea8c4f2604b947e6b7b97750dde87ca
timeCreated: 1506829537
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

/ML-Agents-Input-Example/Assets/ML-Agents/Examples/PushBlock/Prefabs.meta → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs.meta

/ML-Agents-Input-Example/Assets/ML-Agents/Examples/PushBlock/Prefabs → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs

/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs/PushBlockArea.prefab → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs/PushBlockWithInputArea.prefab

/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs/PushBlockArea.prefab.meta → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Prefabs/PushBlockWithInputArea.prefab.meta

/ML-Agents-Input-Example/Assets/ML-Agents/Examples/PushBlock/PushBlockActions.inputactions → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/PushBlockActions.inputactions

/ML-Agents-Input-Example/Assets/ML-Agents/Examples/PushBlock/PushBlockActions.inputactions.meta → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/PushBlockActions.inputactions.meta

/ML-Agents-Input-Example/Assets/ML-Agents/Examples/PushBlock/Scenes.meta → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scenes.meta

/ML-Agents-Input-Example/Assets/ML-Agents/Examples/PushBlock/Scripts.meta → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts.meta

/ML-Agents-Input-Example/Assets/ML-Agents/Examples/PushBlock/Scripts → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts

/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockPlayerController.cs.meta → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputPlayerController.cs.meta

/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetect.cs → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs

/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushAgentBasic.cs → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputAgentBasic.cs

/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockPlayerController.cs → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputPlayerController.cs

/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockSettings.cs → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockWithInputSettings.cs

/Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/PushBlockSettings.cs.meta → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/Scripts/GoalDetectWithInput.cs.meta

/ML-Agents-Input-Example/Assets/ML-Agents/Examples/PushBlock/TFModels → /Project/Assets/ML-Agents/Examples/PushBlockWithInput/TFModels

正在加载...
取消
保存