遇到无定义错误解决方案

error CS1061: Type `UnityEngine.Component' does not contain a definition for `material' and no extension method `material' of type `UnityEngine.Component' could be found. Are you missing an assembly reference?


这种无定义的问题,修改的时候只需要用GetComponenet<>(),就可以。


例如下面所示:


遇到无定义错误解决方案_第1张图片

你可能感兴趣的:(Unity—遇到问题)