unity C# Errors `UnityEngine.Material' does not contain a definition for `SetColorArray'
Hello. For the last few weeks i have been watching a tutorial on random terrain generation (Link Here https://www.youtube.com/watch?v=wbpMiKiSKm8&list=PLFt_AvWsXl0eBW2EiBtl_sxmDtSgZBxB3) FYI: I am on episode 16.
These are the errors
Assets/World/Scripts/Data/TextureData.cs(18,26): error CS1061: Type UnityEngine.Material' does not contain a definition for
SetColorArray' and no extension method SetColorArray' of type
UnityEngine.Material' could be found (are you missing a using directive or an assembly reference?)
And
Assets/World/Scripts/Data/TextureData.cs(19,26): error CS1061: Type UnityEngine.Material' does not contain a definition for
SetFloatArray' and no extension method SetFloatArray' of type
UnityEngine.Material' could be found (are you missing a using directive or an assembly reference?)
The errors are on line 18,26 & 19,26 This is the script
using UnityEngine; using System.Collections;
[CreateAssetMenu()] public class TextureData : UpdatableData {
public Color[] baseColors;
[Range (0,1)]
public float[] baseStartHeights;
float savedMinHeight;
float savedMaxHeight;
public void ApplyToMaterial(Material material) {
material.SetInt ("baseColorCount", baseColors.Length);
material.SetColorArray("baseColors", baseColors);
material.SetFloatArray ("baseStartHeights", baseStartHeights);
UpdateMeshHeights (material, savedMinHeight, savedMaxHeight);
}
public void UpdateMeshHeights(Material material, float minHeight, float maxHeight){
savedMinHeight = minHeight;
savedMaxHeight = maxHeight;
material.SetFloat ("minHeight", minHeight);
material.SetFloat ("maxHeight", maxHeight);
}
}
Any ideas?
Your answer
Follow this Question
Related Questions
How do you assign a material to multiple different objects using arrays? 1 Answer
C# noob question (array realated) 1 Answer
Modify Array in Editor Window - 2020+ 0 Answers
Problem with Resources.Load in Android 0 Answers
Index out of range error 1 Answer