-
- antsonthetree
- Posts: 44
- Joined:
Unity: Best way to access parent NoesisView from xaml code behind?
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
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
-
-
sfernandez
Site Admin
- Posts: 2534
- Joined:
Re: Unity: Best way to access parent NoesisView from xaml code behind?
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.
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: No registered users and 1 guest