dynamic lines
Posted: 16 Jul 2015, 16:32
In Unity, what would be the best way to procedurally add dynamic lines to an xaml file? Some lines in the xaml file will be static (or just rotated), but others must be fully generated at runtime.
This is for aircraft display simulation:
https://www.youtube.com/watch?v=hlNAIt1NeO4
I suppose it is the same as this, but in C#:
http://www.noesisengine.com/docs/Gui.Core._Path.html
I have this code:
But it throws this error:
This is for aircraft display simulation:
https://www.youtube.com/watch?v=hlNAIt1NeO4
I suppose it is the same as this, but in C#:
http://www.noesisengine.com/docs/Gui.Core._Path.html
I have this code:
Code: Select all
using UnityEngine;
using System.Collections;
using Noesis;
public class ND : MonoBehaviour {
void Start (){
NoesisGUIPanel panel = GetComponent<NoesisGUIPanel>();
FrameworkElement root = panel.GetContent();
root.Parent.UseLayoutRounding = false;
UIElement lineRoot = (UIElement)root.FindName("path4137");
lineRoot.RenderTransformOrigin = new Point(0.5f, 0.5f);
TransformGroup group = new TransformGroup();
Line line = new Line();
Thickness thickness = new Thickness(101,-11,362,250);
line.Margin = thickness;
line.StrokeThickness = 4;
line.X1 = 10;
line.X2 = 40;
line.Y1 = 70;
line.Y2 = 70;
group.Children.Add(line);
lineRoot.RenderTransform = group;
}
}
ApplicationException: Non Freezable item added to FreezableCollection
Noesis.FreezableCollection.Add (System.Object item) (at Assets/Plugins/NoesisGUI/Scripts/Proxies/FreezableCollection.cs:94)
ND.Start () (at Assets/Scripts/ND.cs:29)