public void Init(Vector2 centre, RoadCreator creator) { Curve = gameObject.AddComponent <BezierCurve>(); Curve.Init(centre, creator); Material newMaterial = new Material(Shader.Find("Unlit/Transparent")); newMaterial.name = gameObject.name; materialAssetPath = $"Assets/Materials/{newMaterial.name}.mat"; if (!AssetDatabase.IsValidFolder(materialAssetPath)) { AssetDatabase.CreateAsset(newMaterial, materialAssetPath); } MeshRenderer.sharedMaterial = newMaterial; MeshRenderer.sharedMaterial.mainTexture = Texture; UpdatePath(); }
void OnEnable() { curve = (BezierCurve)target; }