Ошибка в строчке :
PathWayPoints tempPathWayPoints = m_pathWayPoints.objectReferenceValue as PathWayPoints;
У меня есть PathManager :
namespace SWS
{
public class PathManager : MonoBehaviour
{
...
[HideInInspector]
public PathWayPoints pathWayPoints;
...
}
}
PathWayPoints:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace SWS
{
[System.Serializable]
public class PathWayPoints {
[SerializeField, HideInInspector]
public List<Vector3> points;
public PathWayPoints(Vector3 centre)
{
points = new List<Vector3>
{
centre+Vector3.left,
centre+(Vector3.left+Vector3.forward)*.5f,
centre + (Vector3.right+Vector3.back)*.5f,
centre + Vector3.right
};
}
public Vector3 this[int i]
{
get
{
return points[i];
}
}
public int NumPoints
{
get
{
return points.Count;
}
}
public int NumSegments
{
get
{
return (points.Count - 4) / 3 + 1;
}
}
public void AddSegment(Vector3 anchorPos)
{
points.Add(points[points.Count - 1] * 2 - points[points.Count - 2]);
points.Add((points[points.Count - 1] + anchorPos) * .5f);
points.Add(anchorPos);
}
public Vector3[] GetPointsInSegment(int i)
{
return new Vector3[] { points[i * 3], points[i * 3 + 1], points[i * 3 + 2], points[i * 3 + 3] };
}
public void MovePoint(int i, Vector3 pos)
{
Vector3 deltaMove = pos - points[i];
points[i] = pos;
if (i % 3 == 0)
{
if (i + 1 < points.Count)
{
points[i + 1] += deltaMove;
}
if (i - 1 >= 0)
{
points[i - 1] += deltaMove;
}
}
else
{
bool nextPointIsAnchor = (i + 1) % 3 == 0;
int correspondingControlIndex = (nextPointIsAnchor) ? i + 2 : i - 2;
int anchorIndex = (nextPointIsAnchor) ? i + 1 : i - 1;
if (correspondingControlIndex >= 0 && correspondingControlIndex < points.Count)
{
float dst = (points[anchorIndex] - points[correspondingControlIndex]).magnitude;
Vector3 dir = (points[anchorIndex] - pos).normalized;
points[correspondingControlIndex] = points[anchorIndex] + dir * dst;
}
}
}
}
}
И PathEditor:
namespace SWS
{
[CustomEditor(typeof(PathManager))]
public class PathEditor : Editor
{
...
private SerializedProperty m_pathWayPoints;
PathWayPoints tempPathWayPoints;
...
public void OnEnable()
{
...
m_pathWayPoints = m_Object.FindProperty("pathWayPoints");
var waypoints = GetWaypointArray();
PathWayPoints tempPathWayPoints = m_pathWayPoints.objectReferenceValue as PathWayPoints; //ошибка error CS0039
if (tempPathWayPoints == null) {
for (int i = 0; i < waypoints.Length; i++) {
if (i == 0) {
tempPathWayPoints = new PathWayPoints (waypoints [i].position);
} else {
tempPathWayPoints.AddSegment (waypoints [i].position);
}
}
}
}
}
}
Достаточно было сделать класс PathWayPoints, наследником : MonoBehaviour
...
namespace SWS
{
[System.Serializable]
public class PathWayPoints : MonoBehaviour {...}
...
}
Айфон мало держит заряд, разбираемся с проблемой вместе с AppLab
Программа рабочая, хочу сделать сборку, создать установщик (в этом опыт есть) и дальше опубликовать на SourceForge и тп
Как можно сделать так,что бы при изменении текста в entry текст копировался в label? В примере в книге элементы располагаются в ContentPage и к ним можно...
Хочу сделать скачивание файла с Meganz с прогресс баром