antsonthetree
Topic Author
Posts: 44
Joined: 09 Jan 2018, 15:56

Unity: Best way to access parent NoesisView from xaml code behind?

11 Mar 2018, 19:33

Hello,

Currently I am getting access to the parent NoesisView from xaml code behind this way:
NoesisView nv = GameObject.FindWithTag("GUICamera").GetComponent<NoesisView>();

But that requires me to always know the game object (GUICamera) the view is attached to.
Is there a better way to find this from a UserControl's code behind?

Thanks
Jake
 
User avatar
sfernandez
Site Admin
Posts: 1625
Joined: 22 Dec 2011, 19:20

Re: Unity: Best way to access parent NoesisView from xaml code behind?

12 Mar 2018, 18:28

Hi,

There is no access method to get that information right now.
Could you please create a ticket in our bugtracker and we will analyze the best way to provide that info?

Meanwhile, you can look for all the NoesisView active components in the scene using Unity's FindObjectsOfType, and then compare VisualTreeHelper.GetRoot(NoesisView.Content) with you user control root (VisualTreeHelper.GetRoot(this)). Please note that this would be very slow, so it wouldn't be recommended to use it every frame.

Who is online

Users browsing this forum: sfernandez and 4 guests