02-05-2020, 12:49 AM
Sorry but I must bother you one more time. This code gives no errors in Visual B.
But once in Unity I get this when I select objects with controllers.
I don't get this, doesn't "List<SplineController> selectedItems" contain the controllers or is it something else I've done wrong?
Code:
private void OnEnable()
{
List<SplineController> selectedItems = Selection.transforms.Select(t => t.gameObject.GetComponent<SplineController>()).Where(c => c != null).ToList();
if (selectedItems.Count > 1)
{
index = 0;
controllers = selectedItems.ToArray();
makeWindow = true;
foreach(SplineController checkController in controllers)
{
orgPos[index] = checkController.AbsolutePosition;
maxPos[index] = checkController.Spline.Length;
Debug.Log(orgPos[index]);
Debug.Log(maxPos[index]);
Debug.Log(controllers[index]);
index++;
}
}
Quote:NullReferenceException: Object reference not set to an instance of an objectLine 42 is the first in the loop.
FluffyUnderware.CurvyEditor.Controllers.MoveMultipleControllers.OnEnable () (at Assets/Game Assets/Editor/MoveMultipleControllers.cs:42)
I don't get this, doesn't "List<SplineController> selectedItems" contain the controllers or is it something else I've done wrong?