Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

Include support for new Input System #373

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Random = UnityEngine.Random;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem; //Only called if using the new InputSystem
#endif

namespace BeardedManStudios.MultiplayerMenu
{
Expand Down Expand Up @@ -209,6 +212,7 @@ public void Host()

private void Update()
{
#if !ENABLE_INPUT_SYSTEM //if using legacy Input System
if (Input.GetKeyDown(KeyCode.H))
Host();
else if (Input.GetKeyDown(KeyCode.C))
Expand All @@ -219,6 +223,20 @@ private void Update()
NetWorker.localServerLocated += TestLocalServerFind;
NetWorker.RefreshLocalUdpListings();
}
#endif

#if ENABLE_INPUT_SYSTEM //if using new Input System
if (Keyboard.current.hKey.isPressed)
Host();
else if (Keyboard.current.cKey.isPressed)
Connect();
else if (Keyboard.current.lKey.isPressed)
{
NetWorker.localServerLocated -= TestLocalServerFind;
NetWorker.localServerLocated += TestLocalServerFind;
NetWorker.RefreshLocalUdpListings();
}
#endif
}

private void TestLocalServerFind(NetWorker.BroadcastEndpoints endpoint, NetWorker sender)
Expand Down