GithubHelp home page GithubHelp logo

Comments (6)

justinbrick avatar justinbrick commented on August 11, 2024

For the Panel.Tick you are supposed to be grabbing input from the Player class, Panel.Tick runs every frame while Player.Tick runs every update, which is why Input.Pressed is firing multiple times. The solution for this if you're creating a menu is to create static controls for your class and call those methods through Player Tick.
As for Player.Tick, input gets checked on both client and server, perhaps try checking for IsClient or IsServer before doing whatever you're trying to do?

from sbox-issues.

Jake-Rich avatar Jake-Rich commented on August 11, 2024

Inside Panel.Tick I was using Player.Local.Input and static fields to access them. I also surrounded everything with IsClient and it still wasn't working.

from sbox-issues.

justinbrick avatar justinbrick commented on August 11, 2024

You have to use Player.Tick is what I'm saying though, if you get Player input through Panel tick it's going to get called multiple times

from sbox-issues.

Jake-Rich avatar Jake-Rich commented on August 11, 2024

I tried both Player.Tick & Panel.Tick and both were unreliable for remote players, while Player.Tick was at least reliable for the local player.

from sbox-issues.

garrynewman avatar garrynewman commented on August 11, 2024

Player.Tick should be, and is in my experience, 100% reliable.

Player.Tick is only called clientside for the local player. If it's being called clientside for remote players then there's something going wrong.

from sbox-issues.

Jake-Rich avatar Jake-Rich commented on August 11, 2024

In BasePlayer class:

protected override void Tick()
{
	if ( IsClient )
	{
		using ( Prediction.Off() )
		{
			if ( Input.Pressed( InputButton.Score ) )
			{
				InventoryPage.Instance.ToggleInventory();
				Log.Info( "Pressed" );
			}
			else if ( Input.Released( InputButton.Score ) )
			{
				Log.Info( "Released" );
			}
		}
	}
}

image

As you can see it fires off Pressed and Released events multiple times in a row. It doesnt matter if IsClient is first or Prediction.Off() is first, or if Prediction.Off() is removed.

from sbox-issues.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.