x


Set/Modify gui texture border from script

Is there a way to set the border properties of a GuiTexture object from script?

I've gone over the available properties several times but I can't seem to find the corresponding properties. Did I miss it or is it just not supported for some reason?

(I'm not referring to the pixel inset btw which I can see, but the "Left Border", "Right Border", ... etc)

more ▼

asked Oct 03 '11 at 05:42 PM

amirabiri gravatar image

amirabiri
1k 16 26 35

OK further digging through old forum archives reveals that this is a pending issue. It is currently not possible to do this with scripting.

Oct 04 '11 at 10:17 AM amirabiri

Damn, I really needed to be able to do this :/

Nov 09 '11 at 02:23 PM Izitmee
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I actually had an idea on how to do this after all which I didn't get around to testing yet so someone else might want to try it:

Checkout SerializedObject and SerializedProperty. You might be able to write a wrapper or utility method that bypasses this limitation and allows you to set the properties from code.

more ▼

answered Nov 09 '11 at 02:30 PM

amirabiri gravatar image

amirabiri
1k 16 26 35

Thanks for the tip amirabiri, but I'd need to do this dynamically at runtime (I'd need just to read those borders, so I can set min size of GUITexture when I scale it), not in an editor script.

Nov 09 '11 at 02:36 PM Izitmee

Yes I forgot that part... my needs were the same.

You could try and "explore" the GuiTexture class with those classes or normal C# reflection and then try to do the same bypass with C# reflection or serialization.

Nov 09 '11 at 03:09 PM amirabiri
(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:

x5089
x3695
x477

asked: Oct 03 '11 at 05:42 PM

Seen: 1546 times

Last Updated: Nov 09 '11 at 03:09 PM