Are there any error messages in the Console log? Here’s some slightly different code. After you’ve updated the code, inside the inspector drag and drop the MeshRenderer component into the slot of the script that says “rend” that you want to change the lightmap index of. Also note it can only be changed in Baked and Mixed modes, although going by your screenshot I assume that’s the case due to the value of lightmapindex for baked.
If this doesn’t work then I honestly don’t know, it’s the classic excuse of “well it’s working on mine” so starting to run out of answers. Although, you’re not just adding the script and checking to see if it has worked right? Because this would change it when you run the game. If you want it to change it inside the editor without playing then that’d require extra code…
using UnityEngine;
using System.Collections;
public class NewBehaviourScript1 : MonoBehaviour
{
public MeshRenderer rend = null;
// Use this for initialization
void Start ()
{
if (rend != null)
{
rend.lightmapIndex = 2;
}
}
// Update is called once per frame
void Update () {
}
}
I get this error message when I drag the script to the objects.
"couldn’t add the script because the script class could not be found…
Yes, I really need this to work in the editor window.