void Init() { Scene scene = SceneManager.GetActiveScene(); if (scene == null) { return; } lightMapping = LightmapSettings.lightmaps[0].lightmapColor; lightDir = LightmapSettings.lightmaps[0].lightmapDir; light = AssetDatabase.LoadAssetAtPath <ObjLightMapping>("Assets/testLight.asset"); }
void getObjLightMapping() { if (testObj == null) { return; } MeshRenderer render = testObj.GetComponent <MeshRenderer>(); if (light == null) { light = new ObjLightMapping(); AssetDatabase.CreateAsset(light, "Assets/testLight.asset"); AssetDatabase.Refresh(); } //Material mat; //mat.SetTextureOffset light.id = 0; light.lightIndex = render.lightmapIndex; light.lightOffset = render.lightmapScaleOffset; }