Forum rules - please read before posting.

Change Joystick effectscaler through script

Hi,

I am trying to change the effectscaler of the Camera Joystick through script but I cannot get it to work and I am not sure about the Joystick/JoystickUI/Download/Template. Is there an easy way to do this? I only need a simple method that sets the effectscaler to a new float.

// Magnus

Comments

  • edited July 2024

    The Joystick and EffectScaler properties are currently read-only, but I can look into making them publicly accessible.

    What's the scenario, and are you referring to the legacy one available on the Downloads page, or the built-in one available within the New Game Wizard?

  • I'm still using the download-one. The scenario is that I use close-ups of Inventory items with a similar approach as that of the First person demo (a 3rd person camera attached to each item-examine-prefab). The Camera joystick is used to spin the object (spin the camera) and I'd like to make the spin slower when examining the objects and the set the effectscaler back to a higher value when in normal play mode.

  • If you're using the Download one, you can affect it with:

    GetComponent<AC.Downloads.MobileJoystick.JoystickUI> ().CameraJoystick.effectScaler
    
  • Thanks. I could be wrong in that I'm using the one with the New Game Wizard, but I don't remember changing it.
    Visual studio gives me the following error:

    Severity    Code    Description Project File    Line    Suppression State
    Error   CS1061  'JoystickUI' does not contain a definition for 'CameraJoystick' and no accessible extension method 'CameraJoystick' accepting a first argument of type 'JoystickUI' could be found (are you missing a using directive or an assembly reference?)
    

    How can I check which Joystick I am using?

  • Open up the script associated with the component on your JoystickUI prefab.

    If you are using the Download one, you may need to re-grab it as the necessary changes made to it may have been made after you last did so.

    The other way to go about this, though, is to have a second JoystickUI, disabled, which then gets enabled (and the original one disabled) so that you switch to an entirely different Joystick setup during this time.

  • Yes, updated the Joystick and all works perfect! Thanks a lot!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.