Page 1 of 1

How to access NoesisView from a TriggerAction

Posted: 04 Jun 2025, 14:44
by RisingSunStudios
Hi,

I have a NoesisApp.TriggerAction that I would like to access the NoesisView to interact with the InputAction asset assigned to it.

Any idea how I can access the NoesisView monobehavior component from inside a trigger?

Re: How to access NoesisView from a TriggerAction

Posted: 10 Jun 2025, 10:55
by sfernandez
Hi,

All AttachableObjects (the base class for TriggerAction) expose a View property. You can use that to find the corresponding NoesisView component available in your scene:
protected override void Invoke(object parameter)
{
  NoesisView[] noesisViews = GetComponents<NoesisView>();
  for (int i = 0; i < noesisViews.Length; i++)
  {
    if (noesisViews[i].Content.View == View)
    {
      // do whatever you need with noesisViews[i]
      break;
    }
  }
}
Is this what you're looking for?

Re: How to access NoesisView from a TriggerAction

Posted: 20 Jul 2025, 08:47
by RisingSunStudios
Hi sorry for late reply,

That is what I'm after yes, but for NoesisApp.TriggerAction<T> I do not have a GetComponents<T>() method in 3.2.8 - is that an extension method?

Re: How to access NoesisView from a TriggerAction

Posted: 24 Jul 2025, 11:18
by sfernandez
I meant to use any API Unity provides to access the desired GameObjects and find all the NoesisView components to search for the correct one.
Sorry for the misunderstanding.

Re: How to access NoesisView from a TriggerAction

Posted: 27 Jul 2025, 16:11
by RisingSunStudios
I'm not sure I understand, there is no game object associated with a NoesisApp.TriggerAction so I can't access the Unity API to get the view unless you mean the static search methods
protected override void Invoke(object parameter)
{
  NoesisView[] noesisViews = GetComponents<NoesisView>(); // how is this possible?
 }
}
If you mean to use the static Unity API like GameObjects.FindWithTag() then sure as a workaround, but I guess the answer is no, you can't get the NoesisView from the TriggerAction itself

Re: How to access NoesisView from a TriggerAction

Posted: 31 Jul 2025, 14:51
by sfernandez
I was referring to the static Unity methods, yes. Sorry for the confusion.

There is no reference from UI elements to the NoesisView component, only to the core View where they are placed.
Perhaps we can store a list of all created NoesisView components and expose a static method in the NoesisView to do something like:
protected override void Invoke(object parameter)
{
  NoesisView view = NoesisView.FromView(this.View);
  ...
}
Could that work for you?

Re: How to access NoesisView from a TriggerAction

Posted: 05 Aug 2025, 19:40
by RisingSunStudios
Hey yeah something like that would work great, but if there's a reason you'd prefer not to do this that is perfectly understandable.

Personally I try to avoid using the static Unity api as much as possible, especially for referencing GameObjects. In our current project we don't have a large number of noesis views so tagging them and using FindByTag() won't be a problem. I was just hoping there was some way to get it via the View, casting it to an interface or something that I may have missed!

Re: How to access NoesisView from a TriggerAction

Posted: 07 Aug 2025, 11:15
by sfernandez
Ok, if you feel a method like that would be helpful for you please create a ticket in our bugtracker and we will try to implement it.
Thanks for your feedback.