How do I make the UserControl of NoesisGUI display at the top level?
Posted: 22 May 2019, 11:09
I have encountered a problem with the combination of Noesis and NGUI on Unity, I want to get your help. We have a need to display panels on 3D models.
My solution is to create a layout interface for the main interface of Canvas, then calculate the coordinates of the 3D model on the screen in each frame, and place the Noesis UserControl at the screen coordinates.
But I now add the NGUI UIRoot to the hierarchy tree and mount the NGUI UISprite under the UIRoot. The goal is to add a Sprite to each model and find that the Sprite under NGUI will block the Noesis panel. As shown below,
I know the reason is that Unity determines the rendering order by the depth of the camera. The depth of the Noesis camera is smaller than the depth of the Camera under NGUI, causing the Noesis panel to be drawn before the NGUI Sprite. How do I correctly ensure that Noesis's UserControl is drawn on top of NGUI's Sprite?

Main.xaml
My solution is to create a layout interface for the main interface of Canvas, then calculate the coordinates of the 3D model on the screen in each frame, and place the Noesis UserControl at the screen coordinates.
But I now add the NGUI UIRoot to the hierarchy tree and mount the NGUI UISprite under the UIRoot. The goal is to add a Sprite to each model and find that the Sprite under NGUI will block the Noesis panel. As shown below,
I know the reason is that Unity determines the rendering order by the depth of the camera. The depth of the Noesis camera is smaller than the depth of the Camera under NGUI, causing the Noesis panel to be drawn before the NGUI Sprite. How do I correctly ensure that Noesis's UserControl is drawn on top of NGUI's Sprite?
Main.xaml
Code: Select all
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Menu x:Name="menu" Grid.Row="0" Background="Black" Opacity="0.85">
<MenuItem Header="File" FontSize="16" Foreground="White" Margin="5"/>
<MenuItem Header="Edit" FontSize="16" Foreground="White" Margin="5"/>
<MenuItem Header="View" FontSize="16" Foreground="White" Margin="5"/>
</Menu>
<Canvas x:Name="canvas" Grid.Row="0" Grid.RowSpan="2"/>
<Border Grid.Row="2" Width="{Binding Path=ActualWidth, ElementName=menu}" Background="Orange">
<TextBlock x:Name="txb" Text="Hello World" Foreground="White" FontSize="12" HorizontalAlignment="Center"/>
</Border>
</Grid>