kurbanismailovzaur / paths Goto Github PK
View Code? Open in Web Editor NEWLibrary for creating, editing and applying paths (waypoints system) in Unity.
Library for creating, editing and applying paths (waypoints system) in Unity.
Hi, Thanks for the well rounded package.
I'm trying to implement on it by adding a float property (speed) visible in the editor below the rotation Vector3 property.
I added a property in the xaml template template PointsListElement.uxml. I can see the property.
I added this in PathInspector.cs (l58 - 80) :
`
foreach (var groupBox in _listView.Query("point-element").Build())
{
var posField = groupBox.Q("point-position");
var rotField = groupBox.Q("point-rotation");
var speedField = groupBox.Q("point-speed");
if (!int.TryParse(groupBox.Q<Label>("point-number").text, out int number))
return;
var point = _inspector.GetPathPoint(number, false);
posField.SetValueWithoutNotify(point.Position);
rotField.SetValueWithoutNotify(_inspector.GetPointEuler(point));
speedField.SetValueWithoutNotify(_inspector.GetPointSpeed(point));
}
if (_inspector._selectedPointIndex != -1)
{
var point = _inspector.GetPathPoint(_inspector._selectedPointIndex, false);
SceneView.lastActiveSceneView.rootVisualElement.Q<Vector3Field>("point-position").SetValueWithoutNotify(point.Position);
SceneView.lastActiveSceneView.rootVisualElement.Q<Vector3Field>("point-rotation").SetValueWithoutNotify(_inspector.GetPointEuler(point));
var speedField = SceneView.lastActiveSceneView.rootVisualElement.Q<FloatField>("point-speed");
speedField.SetValueWithoutNotify(_inspector.GetPointSpeed(point));
}`
I have the visual element with groupBox.Q("point-speed");
but I got null reference a few lines below with
var speedField = SceneView.lastActiveSceneView.rootVisualElement.Q<FloatField>("point-speed");
I'm new to the inspector stuff so it might be an easy mistake.
What could I be missing ?
I have the same issue in the
private void SelectPoint(int index)
method in PathInspector.cs (l 237)
For reference I added this in the PointsListElement.uxml
<ui:GroupBox style="margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0; padding-left: 4px; padding-right: 12px; padding-top: 4px; padding-bottom: 4px; background-color: rgba(43, 77, 57, 0); border-top-left-radius: 0; border-bottom-left-radius: 6px; border-top-right-radius: 0; border-bottom-right-radius: 6px;"> <uie:FloatField label="Speed" name="point-speed" value="42,2" /> </ui:GroupBox>
And I added the Speed property with proper accessor in the Point.cs class.
Thanks again for the asset.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.