Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: pat on November 21, 2014, 03:16:22 AM
-
Dear all,
for the OnValueChange field I can specify a gameobejct and chose a function in the editor.
But I need to assign the gameobject and function during runtime, because this instance is created then and not available in the editor. It stays persistent through all the scenes.
Any ideas ?
Greetings
Pat
-
Prefabs can never keep references to stuff that's not a part of the same prefab.
Think about it. Prefabs don't exist until you create them. How can they possibly keep a reference to something outside them?
-
Hi,
I am not talking about prefabs.
I have a gamestate object which is created at startup of the game (awake). This object is persistent through all scene changes and provides all settings (like volume, game designs) for all scenes.
In the old (free) version of NGUI I did the following:
(http://www.paddybauer.de/pictures/UIslider.png)
The function is known and can be set in the editor (public void setSoundFXVolumeValue(float newSoundFXVolumeValue))
The gameobject not, so I wrote a little script (UISliderSetGamestatInstance) which assigns the gamestate object to the event rcv field at startup time.
I am wondering how to do this in the current version of NGUI
Pat.
-
EventDelegate.Set(slider.onChange, YourCallbackFunction);