public override void OnInspectorGUI() { spriteDeformerAnimation = (SpriteDeformerTargetPoints)target; base.InspectorSpriteDeformer(); base.drawSelectMaterial(); base.InspectorEditToolBar(); // List<Point> canSelecteAsAnimate = new List<Point>(); if (selectedPoints.Count == 1) { SpritePoint sPoint = selectedPoints[0]; SpriteDeformerTargetPoints.PointMover targetMover = spriteDeformerAnimation.getAnimationPoint(sPoint); Transform targetObject = targetMover != null ? targetMover.transform : null; Transform newTarget = (Transform)EditorGUILayout.ObjectField("Target object: ", targetObject, typeof(Transform), true); if (newTarget != targetObject) { if (targetObject == null) { spriteDeformerAnimation.addMoverPoint(sPoint, newTarget); } if (newTarget == null && targetObject != null) { spriteDeformerAnimation.pointMovers.Remove(targetMover); } if (targetObject != newTarget && targetObject != null) { targetMover.transform = newTarget; } if (newTarget != null) { sPoint.offset = spriteDeformer.getOffsetPointPositionByGlobalPosition(sPoint, newTarget.position); upDateMeshDate(); } } } }
public override void OnInspectorGUI() { spriteDeformerAnimation = (SpriteDeformerTargetPoints)target; base.InspectorSpriteDeformer(); base.drawSelectMaterial(); base.InspectorEditToolBar(); // List<Point> canSelecteAsAnimate = new List<Point>(); if (selectedPoints.Count == 1) { SpritePoint sPoint = selectedPoints[0]; SpriteDeformerTargetPoints.PointMover targetMover = spriteDeformerAnimation.getAnimationPoint(sPoint); Transform targetObject = targetMover != null ? targetMover.transform : null; Transform newTarget = (Transform)EditorGUILayout.ObjectField("Target object: ", targetObject, typeof(Transform),true); if (newTarget != targetObject) { if (targetObject == null) { spriteDeformerAnimation.addMoverPoint(sPoint, newTarget); } if (newTarget == null && targetObject!=null) { spriteDeformerAnimation.pointMovers.Remove(targetMover); } if (targetObject != newTarget && targetObject != null) { targetMover.transform = newTarget; } if (newTarget != null) { sPoint.offset = spriteDeformer.getOffsetPointPositionByGlobalPosition(sPoint, newTarget.position); upDateMeshDate(); } } } }