Page 1 of 1

Disable/Enable the Proximity Selector

Posted: Tue Aug 27, 2019 7:00 am
by PandaBOX
Hello there! :D

I've been trying to disable the proximity selector via script and it's not really working out. I'm trying to disable it when my character is jumping, then enable it again when they are grounded.

This is all the code I have related to the proximity selector:

using PixelCrushers.DialogueSystem;

ProximitySelector proximitySelector = GetComponent<ProximitySelector>().enabled = false;

But I get this error:
BasicWalkerController.cs(337,41): error CS0029: Cannot implicitly convert type 'bool' to 'PixelCrushers.DialogueSystem.ProximitySelector

Sorry if this is a bit simple, but I just can't seem to figure it out.

Re: Disable/Enable the Proximity Selector

Posted: Tue Aug 27, 2019 8:36 am
by Tony Li
Hi,

Remove that first part. Try just this:

Code: Select all

GetComponent<ProximitySelector>().enabled = false;
Or, better yet, look up the ProximitySelector once in Awake and then use that reference whenever you jump:

Code: Select all

private ProximitySelector proximitySelector;
private void Start()
{
    proximitySelector = GetComponent<ProximitySelector>();
}
...
void Jump() // EXAMPLE
{
    proximitySelector.enabled = false;

Re: Disable/Enable the Proximity Selector

Posted: Tue Aug 27, 2019 11:46 pm
by PandaBOX
Ah, thanks so much! It's working great. I still had to have this part:

using PixelCrushers.DialogueSystem;

Otherwise I would get errors about not knowing what the proximity selector was, but grouped with the code it's working just fine! :D Thanks again Tony!

Re: Disable/Enable the Proximity Selector

Posted: Wed Aug 28, 2019 8:06 am
by Tony Li
Happy to help!