Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using UnityEngine;
- namespace sc.modeling.splines.runtime.auxiliary
- {
- [ExecuteAlways]
- //Copies the SplineMesher scale data from the source to the destination
- public class CopySplineMesherScale : MonoBehaviour
- {
- public SplineMesher source;
- public SplineMesher destination;
- private void Reset()
- {
- destination = GetComponent<SplineMesher>();
- }
- private void OnEnable()
- {
- SplineMesher.onPreRebuildMesh += OnPreRebuild;
- }
- private void OnDisable()
- {
- SplineMesher.onPreRebuildMesh -= OnPreRebuild;
- }
- private void OnPreRebuild(SplineMesher instance)
- {
- //Scale data is tailored to specific splines, so only allow copying if both components actually use the same splines.
- if (source.splineContainer == destination.splineContainer)
- {
- destination.scaleData = source.scaleData;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement