Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanunity committed Sep 4, 2023
2 parents e299891 + e25e307 commit a830638
Show file tree
Hide file tree
Showing 91 changed files with 2,660 additions and 148 deletions.
2 changes: 1 addition & 1 deletion Assets/Samples/CustomComposite/CustomComposite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public override void OnGUI()
target.scaleFactor = EditorGUILayout.Slider(m_ScaleFactorLabel, currentValue, 0, 2);
}

#if UNITY_INPUT_SYSTEM_UI_TK_ASSET_EDITOR
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback)
{
var slider = new Slider(m_ScaleFactorLabel.text, 0, 2)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Samples/InGameHints/InGameHintsActions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.7.0
// version 1.8.0
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
Expand Down
8 changes: 8 additions & 0 deletions Assets/Samples/ProjectWideActionsTest.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "ProjectWideActionsTest",
"rootNamespace": "",
"references": [
"GUID:75469ad4d38634e559750d17036d5f7c"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "Unity",
"expression": "2022.3",
"define": "UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS"
}
],
"noEngineReferences": false
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions Assets/Samples/ProjectWideActionsTest/ProjectWideActionsTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS

using UnityEngine;
using UnityEngine.InputSystem;

public class NewBehaviourScript : MonoBehaviour
{
[SerializeField] public GameObject cube;

InputAction move;
InputAction look;
InputAction attack;
InputAction jump;
InputAction interact;
InputAction next;
InputAction previous;
InputAction sprint;
InputAction crouch;

// Start is called before the first frame update
void Start()
{
// Project-Wide Actions
move = InputSystem.actions.FindAction("Player/Move");
look = InputSystem.actions.FindAction("Player/Look");
attack = InputSystem.actions.FindAction("Player/Attack");
jump = InputSystem.actions.FindAction("Player/Jump");
interact = InputSystem.actions.FindAction("Player/Interact");
next = InputSystem.actions.FindAction("Player/Next");
previous = InputSystem.actions.FindAction("Player/Previous");
sprint = InputSystem.actions.FindAction("Player/Sprint");
crouch = InputSystem.actions.FindAction("Player/Crouch");
}

// Update is called once per frame
void Update()
{
if (attack.WasPressedThisFrame())
{
cube.GetComponent<Renderer>().material.color = Color.red;
}
else if (attack.WasReleasedThisFrame())
{
cube.GetComponent<Renderer>().material.color = Color.green;
}

var moveVal = move.ReadValue<Vector2>();
if (moveVal.x < 0.0f)
{
cube.transform.Translate(new Vector3(-10 * Time.deltaTime, 0, 0));
}
else if (moveVal.x > 0.0f)
{
cube.transform.Translate(new Vector3(10 * Time.deltaTime, 0, 0));
}
if (moveVal.y < 0.0f)
{
cube.transform.Translate(new Vector3(0, -10 * Time.deltaTime, 0));
}
else if (moveVal.y > 0.0f)
{
cube.transform.Translate(new Vector3(0, 10 * Time.deltaTime, 0));
}
}
}
#endif

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a830638

Please sign in to comment.