using System.Collections; using System.Collections.Generic; using UnityEngine; public class WaterSetUp : MonoBehaviour { // Use this for initialization void Start () { Vector3 originalScale = transform.localScale; Vector2 texScale = Vector3.one;// GetComponent().material.GetTextureScale("_Perlin"); transform.localScale = Vector3.one; for (float x = -originalScale.x/2; x < originalScale.x / 2; x++) { for (float z = -originalScale.z / 2; z < originalScale.z/2; z++) { //Debug.Log("blah"); Vector3 pos = transform.position; pos.x += transform.lossyScale.x * x; pos.z += transform.lossyScale.z * z; Vector2 texOffset = new Vector2(texScale.x * x, texScale.y * z); GameObject waterClone = Instantiate(gameObject, pos, transform.rotation, transform); // waterClone.GetComponent().material.SetTextureOffset("_Diffuse", texOffset); // waterClone.GetComponent().material.SetTextureOffset("_Normals", texOffset); // waterClone.GetComponent().material.SetTextureOffset("_Perlin", texOffset); // waterClone.GetComponent().material.SetTextureOffset("_Perlin_copy", texOffset); } } Debug.Log("blah"); } }