Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using the StarterAssets Third Person Controller with InputReceiver Events

Discussion in 'Unity Render Streaming' started by leeprobert, Oct 24, 2023.

  1. leeprobert

    leeprobert

    Joined:
    Feb 12, 2015
    Posts:
    44
    I am using the `Starter Assets Third Person Controller` which uses a script `StarterAssetsInputs` to manage the inputs `OnLook`, `OnMove` etc.

    I need to map these functions to the cameras `InputReceiver` events so I can capture the inputs and send the same messages. I can't see how to do this using the events in the `InputReceiver`. The `OnLook` methods in the `StarterAssetsInputs` script take an `InputValue` like this:

    Code (CSharp):
    1. public void OnMove(InputValue value)
    2. {
    3.     MoveInput(value.Get<Vector2>());
    4. }
    I can see that the `InputReceiver` takes a `CallbackContext`.
    Do I need to create other public methods in the `StarterAssetsInputs` script and get the input from the context?
     
  2. leeprobert

    leeprobert

    Joined:
    Feb 12, 2015
    Posts:
    44
    Code (CSharp):
    1.  
    2. public void OnRemoteMove(InputAction.CallbackContext value)
    3. {
    4.     MoveInput(value.ReadValue<Vector2>());
    5. }
    6. public void OnMove(InputValue value)
    7. {
    8.      MoveInput(value.Get<Vector2>());
    9. }
    10.  
    I added these `OnRemote` methods to the `StarterAssetsInputs` script and then was able to connect them to the events in the `InputReceiver` ... however, I don't get any feedback or logs from this when streaming it in the browser.
     
  3. leeprobert

    leeprobert

    Joined:
    Feb 12, 2015
    Posts:
    44
    Do you need to add the `InputSender` to the camera as well?