x


Resize lightmaps array??

I'm making a "Beast Helper" script, that save gameobjects list and tiling info for each lightmap, and you can restore it later. Everything seems to work, but I have a problem: LightMapSettings.Lightmaps[] cannot be resized... (The length property is read only).

I need to set the number of lightmaps from script, otherwise my script can cause Out of index errors when trying to set a number of lightmaps bigger than LightMapSettings.Lightmaps.Length...

Any ideas?? Thanks

more ▼

asked Sep 28 '10 at 11:42 AM

user-710 (google) gravatar image

user-710 (google)
34 7 7 13

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Store the array reference in a temporary variable, resize it (Array.Resize - you can't modify .Length in a normal array either), then push it back into the variable

In c# it'd look something like this:

LightmapData[] lightmaps = LightMapSettings.Lightmaps;
System.Array.Resize(lightmaps, newSize);
LightMapSettings.Lightmaps = lightmaps;
more ▼

answered Sep 28 '10 at 12:35 PM

Mike 3 gravatar image

Mike 3
30.5k 10 65 252

Thanks for the quick response, I will test it now...

Sep 28 '10 at 12:48 PM user-710 (google)
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1356
x327
x207

asked: Sep 28 '10 at 11:42 AM

Seen: 1656 times

Last Updated: Sep 28 '10 at 12:23 PM