Search Unity

Resolved Expecting control of type x but got y

Discussion in 'Input System' started by eitanbariboa, Sep 2, 2022.

  1. eitanbariboa

    eitanbariboa

    Joined:
    Mar 19, 2020
    Posts:
    26
    Hello i am having issues with setting values for inputDevice.
    WriteValueIntoEvent();

    I set the type Button but i don't know which value should i pass. (Float,Int,Bool or etc)

    Is there a way of getting the type of value it requires so i will be able to pass the value i want?


    Ex: if the value is type bool i will pass true or false, if it's int i will pass 0 to 1.

    Code (CSharp):
    1.                 using (StateEvent.From(grip, out eventPtr))
    2.                 {
    3.                     grip.WriteValueIntoEvent<int>(1, eventPtr);
    4.                     InputSystem.QueueEvent(eventPtr);
    5.                 }
    Edit: i did debuging
    grip.GetType().FullName returns axisControl so i tried to pass
    grip.WriteValueIntoEvent(axisControl.clamp.none, eventPtr);
     
    Last edited: Sep 2, 2022
  2. eitanbariboa

    eitanbariboa

    Joined:
    Mar 19, 2020
    Posts:
    26
    Nevermind my bad. i got it resolved i passed the wrong input action