Issue: Triggered Objects and triggered objects amount is not equal

Keplerians

New member
Hi!

I am having an issue with a own system of floating buttons when the player is near interactable objects.

I am triggering by my side the interactable objects, and i figured out that the detectObjectAbilityBase has some issues with triggered objects.

My code example to test, the result while playing. This component is attached to my character, and as you can see, the trigger amount and the triggers are not equal.

Captura de pantalla 2020-05-13 a las 20.31.39.png

C#:
 public class TriggerDetectionTest : MonoBehaviour
    {
        public List<GameObject> triggers;
        public int triggerAmount;
        CustomInteract customInteractAbility;

        void Start()
        {
            customInteractAbility = GetComponent<UltimateCharacterLocomotion>().GetAbility<CustomInteract>();
        }


        void Update()
        {
            if (customInteractAbility != null)
            {
                triggers = customInteractAbility.detectedObjects.ToList();
                triggerAmount = customInteractAbility.triggerAmount;
            }
        }
    }

For accessing the detected objects array and the trigger amount, i have the next code:

C#:
  public GameObject[] detectedObjects => m_DetectedTriggerObjects;
  public int triggerAmount => m_DetectedTriggerObjectsCount;

So, it seems that in some way, the detected trigger objects array is not being updated properly...
Any idea about this?

Thanks,
 
I have tried in the demo scene.

I attach here a video.

I duplicated twice an existing door in the scene, and put them in the starting room. Then, I made the collider width bigger to test triggering 2 doors, without success.

This is the line I adapted to make work my previous script: (and of course, the customInteractAbility variable, changed to "Interact" type.)

C#:
customInteractAbility = GetComponent<UltimateCharacterLocomotion>().GetAbilities<Interact>()[4];

The video is not the best one, the scene was a little laggy for me, but please if you could test yourself to see if it is working, i would appreciate it. Supporting multiple trigger amount is very important for some of our features/systems.

Thanks again.
 
Top