edited August 2016 in ORK Support
Good morning!

Just a quick question. I'm having a little difficulty I'm hoping someone can help me with. So, I have UFPS and I'm basically just trying to set the force show cursor property in the vp_FPInput script when I open a menu or dialog of any sort. I have my custom controls set properly, but the cursor never shows. So, I wrote a script to just set this property when the same key as the accept key in Ork is pressed. Obviously this is a messy solution and can get out of synch if the player pressed multiple times. So, does ORK have the capability to set that property on blocking events? What avenue would be the best to take?

image
Post edited by jrock84 on
  • ORK will disable/enable the component you specified when blocking/unblocking player controls - i.e. you could add what you need to do in the OnEnable and OnDisable component functions (or write a new component for that and add it to ORK's custom controls).

    Alternatively, you can set the property with Change Fields steps in your events.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited August 2016
    Thank GIL, but can you elaborate on the OnEnable and OnDisable components? I basically need the bool in vp_FPInput to force show cursor set to true when menus are active and false when the menus close. Does that make sense? Still learning, so I appreciate your time!

    Thanks!
    Post edited by jrock84 on
  • edited August 2016
    I haven't used UFPS, so I probably don't have the correct property name here, but what you want to do is create a new component to bridge the UFPS input to ORK. I'll call it UFPSControllerBridge:

    [RequireComponent(typeof(vp_FPInput))]
    public class UFPSControllerBridge: MonoBehaviour
    {
    private vp_FPInput _input;

    void Awake()
    {
    _input = GetComponent<vp_FPInput>();
    }

    void OnEnable()
    {
    _input.enabled = true;
    _input.ForceShowCursor = false;
    }

    void OnDisable()
    {
    _input.ForceShowCursor = true;
    _input.enabled = false;
    }
    }


    Use this new script in the Custom Controls rather than vp_FPInput directly. So when ORK enables or disables the player controls, it will enable or disable UFPSControllerBridge. The OnEnable() and OnDisable() methods on this component will then take care of anything that needs to be done when ORK enables or disables the player controls. So you could add to this if you find that you need to do anything else when blocking or unblocking the player controls.

    Note that when enabling, I first enable vp_FPInput before changing the cursor setting, while when disabling I do it in the opposite order. This is intentional, as the property setter that we're changing could very well contain additional code beyond just setting the component's private boolean value. So we want to make sure the component is enabled before changing that property's value.
    Post edited by Keldryn on
  • Thank you both so much! That's exactly what I was looking for and still being new to programming I couldn't quite wrap my head around it. I'll test this out later today.
Sign In or Register to comment.