Welcome,
Guest
. Please
login
or
register
.
January 13, 2025, 09:53:55 PM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Force Update UILable with UILocalize in editor
« previous
next »
Print
Pages: [
1
]
Author
Topic: Force Update UILable with UILocalize in editor (Read 3137 times)
Malzbier
Jr. Member
Thank You
-Given: 0
-Receive: 0
Posts: 93
Force Update UILable with UILocalize in editor
«
on:
August 09, 2012, 05:03:15 AM »
I like to force update a(or multible) UILable with UILocalize in editor.
So i wrote a custom inspector for UILocalize:
[
CustomEditor
(
typeof
(
UILocalize
)
)
]
public
class
UILocalizeInspector
:
Editor
{
UILocalize mUILocalize
;
public
override
void
OnInspectorGUI
(
)
{
DrawDefaultInspector
(
)
;
EditorGUIUtility
.
LookLikeControls
(
80f
)
;
mUILocalize
=
target
as
UILocalize
;
if
(
GUILayout
.
Button
(
"Localize!"
)
)
{
mUILocalize
.
Localize
(
)
;
mUILocalize
.
gameObject
.
GetComponent
<
UILabel
>
(
)
.
MarkAsChanged
(
)
;
}
}
}
My problem is that the update process of UILabel sheems to call the UIRoot Scritp witch is Producing the following error in the editor around 10 times:
!
IsPlayingOrAllowExecuteInEditMode
(
)
UnityEngine
.
Component
:
BroadcastMessage
(
String
,
Object
, SendMessageOptions
)
UIRoot
:
Broadcast
(
String
,
Object
)
(
at Assets
/
NGUI
/
Scripts
/
UI
/
UIRoot
.
cs
:
91
)
Localization
:
Load
(
TextAsset
)
(
at Assets
/
NGUI
/
Scripts
/
Internal
/
Localization
.
cs
:
157
)
Localization
:
set_currentLanguage
(
String
)
(
at Assets
/
NGUI
/
Scripts
/
Internal
/
Localization
.
cs
:
100
)
Localization
:
get_currentLanguage
(
)
(
at Assets
/
NGUI
/
Scripts
/
Internal
/
Localization
.
cs
:
69
)
UILocalize
:
Localize
(
)
(
at Assets
/
NGUI
/
Scripts
/
UI
/
UILocalize
.
cs
:
73
)
UILocalizeInspector
:
OnInspectorGUI
(
)
(
at Assets
/
Scripts
/
GUI
/
Editor
/
UILocalizeInspector
.
cs
:
24
)
UnityEditor
.
DockArea
:
OnGUI
(
)
Without:
mUILocalize
.
gameObject
.
GetComponent
<
UILabel
>
(
)
.
MarkAsChanged
(
)
;
there are no errors.
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Force Update UILable with UILocalize in editor
«
Reply #1 on:
August 09, 2012, 02:07:52 PM »
Localization system is not marked as ExecuteInEditMode, so it won't work unless the application is playing. Same with UIRoot. The system is simply not designed to be executed in edit mode.
Logged
Print
Pages: [
1
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Force Update UILable with UILocalize in editor