Thank you for your quick answer.
but with your code, I tried and saw something created in Hierarchy but i found some error message in console.
- My code:
GameObject go = Resources.Load ("Prefabs/pf_main_pencil") as GameObject;
UISprite sp1 = NGUITools.AddWidget<UISprite>(go);
- error message in console:
Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.
UnityEngine.Transform:set_parent(Transform)
NGUITools:AddChild(GameObject, Boolean) (at Assets/NGUI/Scripts/Internal/NGUITools.cs:371)
NGUITools:AddChild(GameObject) (at Assets/NGUI/Scripts/Internal/NGUITools.cs:356)
NGUITools:AddChild(GameObject) (at Assets/NGUI/Scripts/Internal/NGUITools.cs:752)
PS. I am using the latest NGUI version in Unity 4.2 , which I purchased two weeks ago.
NGUITools:AddWidget(GameObject) (at Assets/NGUI/Scripts/Internal/NGUITools.cs:777)