@@ -108,7 +108,7 @@ void Update()
108108
109109 for ( int ii = 0 ; ii < m_Renderers . Length ; ii ++ )
110110 {
111- m_Renderers [ ii ] . renderingLayerMask &= 0xff ;
111+ m_Renderers [ ii ] . renderingLayerMask &= 0xffffff00 ;
112112 m_Renderers [ ii ] . renderingLayerMask |= ( uint ) m_targetBoxLight . lightlayersMask ;
113113 }
114114 if ( /* m_targetBoxLight != null && */ m_GameObjects != null && m_GameObjects . Length > 0 && m_GameObjects [ 0 ] != null )
@@ -163,17 +163,17 @@ void UpdateObjectLightLayers()
163163
164164 }
165165
166- internal static GameObject CreateBoxLight ( GameObject go )
166+ internal static GameObject CreateBoxLight ( GameObject [ ] gameObjects )
167167 {
168- if ( go == null )
168+ if ( gameObjects == null || gameObjects [ 0 ] == null )
169169 {
170170 Debug . LogError ( "Please, select a GameObject you want a Box Light to follow." ) ;
171171 return null ;
172172 }
173- var gameObjectName = "Box Light for " + go . name ;
173+ var gameObjectName = "Box Light for " + gameObjects [ 0 ] . name ;
174174 GameObject lightGameObject = new GameObject ( gameObjectName ) ;
175175#if UNITY_EDITOR
176- Undo . RegisterCreatedObjectUndo ( lightGameObject , "Created " + go . name ) ;
176+ Undo . RegisterCreatedObjectUndo ( lightGameObject , "Created Boxlight adjustment" ) ;
177177#endif
178178 HDAdditionalLightData hdLightData = lightGameObject . AddHDLight ( HDLightTypeAndShape . BoxSpot ) ;
179179 // light size
@@ -210,8 +210,8 @@ internal static GameObject CreateBoxLight(GameObject go)
210210 hdLightData . gameObject . transform . rotation = goRot ;
211211
212212 // must be put to gameObject model chain.
213- boxLightAdjustment . m_GameObjects = new GameObject [ 1 ] ;
214- boxLightAdjustment . m_GameObjects [ 0 ] = go ;
213+ boxLightAdjustment . m_GameObjects = gameObjects ;
214+
215215
216216 return lightGameObject ;
217217 }
0 commit comments