Exemple #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();
        }
Exemple #2
0
 void OnEnable()
 {
     creator = (RoadCreator)target;
 }