Esempio n. 1
0
        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();
        }
Esempio n. 2
0
 void OnEnable()
 {
     curve = (BezierCurve)target;
 }