Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class FloppyObject : MonoBehaviour {
- [SerializeField]
- private LineRenderer _renderer;
- [SerializeField]
- private Transform[] _children;
- private void Start() {
- _renderer.positionCount = _children.Length;
- }
- private void Update() {
- UpdateRenderer();
- }
- private void OnDrawGizmos()
- {
- _renderer.positionCount = _children.Length; // Required as the 'Start' method is not called in the editor
- UpdateRenderer();
- }
- private void UpdateRenderer()
- {
- _renderer.SetPositions(_children.Select(c => c.position).ToArray());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement