Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Error CS0029 Help? (Screenshot of Exact Error)

$
0
0
using UnityEngine; using System.Collections; public class ChangeMaterial : MonoBehaviour { private Renderer rend; private Shader differentShader; public int[,] materials = new int [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]; void Start () { differentShader = Shader.Find ("Toon/Lit Outline"); rend = GetComponent (); rend.enabled = true; rend.sharedMaterial = materials[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]; for (int i = 0; i < materials.Length; i++) { rend.sharedMaterial.shader = differentShader; } } } ![Error Screenshot][1] [1]: /storage/temp/81062-screen-shot-2016-10-27-at-41507-pm.png I created this "for" loop earlier to change the Shader of all 30 elements (which are materials) at the beginning of the scene. I am using an array as opposed to a list because the indexes will not change. The error is in line 10. What am I doing wrong?

Viewing all articles
Browse latest Browse all 7934

Trending Articles