RisingSunStudios
Topic Author
Posts: 21
Joined: 12 Apr 2020, 09:56

How to access NoesisView from a TriggerAction

04 Jun 2025, 14:44

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?
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: How to access NoesisView from a TriggerAction

10 Jun 2025, 10:55

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?
 
RisingSunStudios
Topic Author
Posts: 21
Joined: 12 Apr 2020, 09:56

Re: How to access NoesisView from a TriggerAction

20 Jul 2025, 08:47

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?
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: How to access NoesisView from a TriggerAction

24 Jul 2025, 11:18

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.
 
RisingSunStudios
Topic Author
Posts: 21
Joined: 12 Apr 2020, 09:56

Re: How to access NoesisView from a TriggerAction

27 Jul 2025, 16:11

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
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: How to access NoesisView from a TriggerAction

31 Jul 2025, 14:51

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?
 
RisingSunStudios
Topic Author
Posts: 21
Joined: 12 Apr 2020, 09:56

Re: How to access NoesisView from a TriggerAction

05 Aug 2025, 19:40

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!
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: How to access NoesisView from a TriggerAction

07 Aug 2025, 11:15

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.

Who is online

Users browsing this forum: No registered users and 5 guests