playMaker

Author Topic: Pressing keys to turn on objects doesn't work. Help  (Read 9972 times)

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Pressing keys to turn on objects doesn't work. Help
« on: January 16, 2014, 03:37:18 PM »
https://db.tt/gFYillNq

I got the idea to turn on lights in objects for a game prototype after watching the light playmaker tutorial. Doesn't work though.

https://db.tt/tMDdGzaK
https://db.tt/tZdRa2SS



Why isn't this working?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #1 on: January 16, 2014, 03:48:33 PM »
There is no input called "off light".

If you want the Input named "Horizontal" to turn affect the light then you need to type Horizontal in the button name.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #2 on: January 16, 2014, 04:02:24 PM »
There is no input called "off light".

If you want the Input named "Horizontal" to turn affect the light then you need to type Horizontal in the button name.

The button/object's name in the Hierarchy of the project? Or in the playmaker editor?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #3 on: January 16, 2014, 04:18:26 PM »
Get Button is referring to the Input Manager for a name.

It has nothing to do with the objects in the scene.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #4 on: January 16, 2014, 04:24:42 PM »
Get Button is referring to the Input Manager for a name.

It has nothing to do with the objects in the scene.

So all I would have to do is go into both states and change Button Name in Get Button Up and Down to Horizontal Up and Down?


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #5 on: January 16, 2014, 04:29:25 PM »
Just Horizontal, it will read the setting in Input Manager and use the keys you specify there for Positive and Negative.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #6 on: January 16, 2014, 04:35:00 PM »
Just Horizontal, it will read the setting in Input Manager and use the keys you specify there for Positive and Negative.

In Button Name for both states?
« Last Edit: January 16, 2014, 04:47:46 PM by coffeeANDsoda »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #7 on: January 16, 2014, 04:49:08 PM »
Yes, the name of the button is the Name in Input Manager.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #8 on: January 16, 2014, 08:43:13 PM »


There appears to be two horizontals.

https://db.tt/IJx1ZbLB
https://db.tt/aRHrow8v

Get Button down doesn't seem to be interacting with Get Button Up. So I still have the same error while playing.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #9 on: January 16, 2014, 09:10:21 PM »
If you look at the settings you'll find that the second Horizontal is setup for Joystick controls only and does not interfere with the first Horizontal which is setup for the A and D keys.

If you want to use the Button actions you need to tell it to use some control name in the Input Manager, then set that Input up with the keys you want to use. Otherwise you could use Get Key and tell it which key on the keyboard to use.

You should probably read the Unity Docs to understand what the Input Manager is actually for.

http://docs.unity3d.com/Documentation/Components/class-InputManager.html
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #10 on: January 16, 2014, 09:25:40 PM »
If you want to use the Button actions you need to tell it to use some control name in the Input Manager, then set that Input up with the keys you want to use. Otherwise you could use Get Key and tell it which key on the keyboard to use.

Do I add Get Key along with Key Up and Down actions in both states? Did take a look at the input document though.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #11 on: January 16, 2014, 09:34:25 PM »
Do you want to know when the key is up/down? Or do you want to store its status in a bool?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #12 on: January 16, 2014, 09:46:04 PM »
Do you want to know when the key is up/down? Or do you want to store its status in a bool?

To display the activity of the key? I want to make a object be lit up by pressing/holding down a key and when released the light turns off.
« Last Edit: January 16, 2014, 10:03:55 PM by coffeeANDsoda »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #13 on: January 16, 2014, 10:56:23 PM »
You could do it either way then, Get Key just store's a bool, Get Key Up and Get Key Down are specific to sending events when the key is pressed/not pressed.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

coffeeANDsoda

  • Hero Member
  • *****
  • Posts: 618
Re: Pressing keys to turn on objects doesn't work. Help
« Reply #14 on: January 16, 2014, 11:15:11 PM »
« Last Edit: January 17, 2014, 12:00:02 AM by coffeeANDsoda »