Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - sisso

Pages: 1 [2] 3 4
16
ArenMook ruined my thread by remove the mTex and mMat from UIWigets in NGUI last version (2.6.5). Now how I will debug this problem? Hehehe This is a joke.

It appear to solve the problem once all, and without any crazy process (like loop over all prefabs enabling/disabling components).

You save my day, I'm very grateful.

17
I was very curious about it and had the same question when started my GUI. But later I thought, if I can't see in my profile test, It don't bother me :P

18
NGUI 3 Support / Re: Different layouts for different devices
« on: September 03, 2013, 07:01:38 AM »
My advices are:

- Use prefabas and load it when necessary for target device.
- Learn how to have a SD/HD version in same build.
- Don't mix logic and interface code (MVC like)

19
I have created a sample project to do some tests. It is a little crazy when the hd reference get stuck and when its lose.

I can always cause the problem if a create a new Widget pointing to AtlasRef that point to AtlasHd and save scene. The component enabled/disabled fix the problem. For prefabs too. But you must always execute before build, because there is some situations where old Widgets back the texture HD reference again. It works for prefab too.

So, I need to go back to my project to identify why it now works there.

I put this sample project into github https://github.com/sisso/ngui-hdsd and could be used to understand the atlas replacement or building scripts for prefabs and scenes. NGUI is not there, it is at .gitignore.

20
OK, the problem appears to affect widgets inside a prefab. I tried disable/enable the gameObject and components for UIWidget and UIRoot but without success. But the code below work in the editor:

  1. var list = GameObject.FindObjectsOfType(UIWidget);
  2. for (var c: UIWidget in list) {
  3.         if (!c.keepMaterial) {
  4.                 c.material = null;
  5.                 c.mainTexture = null;
  6.         }
  7. }

Edited:

Testing more deep it appear to not work, and UIWidget.mainTexture = null could more problems (like set atlas.material.mainTexture to null).

21
It is simple a code that allow to iterate and modify all prefabs in editor. For example, if you want to remove all objects with Component Debug before a release build.

22
If mMat and mTex are used both for real references and caching, it smell that could be refactored in two variables.  :P Thanks, I will test this today.

@motionsmith, This could help you:
  1. static function ApplyPrefabsBuildCustoms() {
  2.                 EditorApplication.NewScene();
  3.                 var paths = FindPaths(["*.prefab"]);
  4.                 for (var path in paths) {
  5.                         var p = AssetDatabase.LoadMainAssetAtPath(path);
  6.                         var obj = PrefabUtility.InstantiatePrefab(p) as GameObject;
  7.                         var changed = false;
  8.                         // do whatever you want with prefab instance
  9.                         // ...
  10.                         if (changed) PrefabUtility.ReplacePrefab(obj, p, ReplacePrefabOptions.Default);
  11.                         GameObject.DestroyImmediate(obj);
  12.                 }
  13.         }
  14.        
  15. static function FindPaths(filters: String[]): String[] {
  16.         var paths = new List.<String>();       
  17.         for (var filter in filters) {
  18.                 var files = Directory.GetFiles(Application.dataPath, filter, SearchOption.AllDirectories);
  19.                 for(var f in files) {
  20.                         paths.Add(NormalizeDataPath(f));
  21.                 }
  22.         }
  23.         return paths.ToArray();
  24. }
  25.  
  26. static function NormalizeDataPath(path: String) {
  27.         var normalizedPath = "Assets" + path.Replace(Application.dataPath, "").Replace('\\', '/');
  28.         return normalizedPath;
  29. }

23
NGUI 3 Support / Re: memoryproblem on android
« on: August 30, 2013, 10:11:35 AM »
Interesting, it really could be helpful. I didn't found this thread. Could you please post the link?

24
NGUI 3 Support / Re: memoryproblem on android
« on: August 30, 2013, 07:54:36 AM »
In the editor, if you select the atlas texture and "Find References In Scene", it's show anything?

Remember that prefabs references counts as dependencies. For exemplo: If you have a object that point to GamePrefab, that point to StorePrefab and it points to SellPopup that has a Widget pointing to atlas. The atlas will be load in memory.

Debug in unity why something is loaded is really a pain in the ass :P

25
If I remove the [SerializeField] from widget. Bad things will happens?

26
I think that this thread could be related with mine. Where even deleting the HD atlas, it is still referenced by some Widgets at Awake.

http://www.tasharen.com/forum/index.php?topic=5591.0

27
Hi Guys.

I think that NGui Widget are serializing a directly reference to the atlas texture that cause Unity3d load in memory the unused HD texture.

I added in UIWidget:

  1. // Awake
  2.                 Debug.Log(gameObject ": " (mMat == null ? "no material": mMat.name));
  3.                 Debug.Log(gameObject ": " (mTex == null ? "no texture": mTex.name));
  4.  
  5. // Start
  6.                 Debug.Log("START: " gameObject ": " (mMat == null ? "no material": mMat.name));
  7.                 Debug.Log("START: " gameObject ": " (mTex == null ? "no texture": mTex.name));
  8.  
And receive these logs in editor:

  1. FadingSprite (UnityEngine.GameObject): no material
  2. FadingSprite (UnityEngine.GameObject): MenuAtlasHd
  3.  
  4. START: FadingSprite (UnityEngine.GameObject): MenuAtlasSD
  5. START: FadingSprite (UnityEngine.GameObject): MenuAtlasSD
  6.  
I was debug why some HD textures from atlas/font are being loading in memory. Showed by Resources.FindObjectsOfTypeAll(typeof(Texture). These texture are being loaded even if I delete the AtlasHD.prefab or AtlasHD.mat.

Some considerations:

- this test I execute in Editor
- I using classic solution for multiples atlas resolution in same build: AtlasRef, AtlasHd, AtlasSD.
- AtlasRef have replacement and material cleared before build.
- AtlasRef is pointed from AtlasHD/SD loaded from resource at first scene.
- Every widget is pointing to AtlasRef
- Some time in the past I think that some widgets pointed directly to HD version (could be cached that time?)
- many of theses widgets are stored in prefabs

NGUI master, could you give a look if it really could happens? Or can give me a direction for what I probably is doing wrong?

--  Added

In editor if I select the atlas texture and use contextual menu "Find References in Scene", the unity select the widgets where Awake show HD texture.


28
NGUI 3 Support / Re: TweenAlpha and UIPanel Help needed
« on: August 23, 2013, 08:13:32 PM »
Read again:

Quote
CS1503: Argument `#1' cannot convert `UIPanel' expression to type `UnityEngine.GameObject'

So, you are trying to give a UIPanel where it ask for a GameObject. UIPanel is a Component, from a Component you can access the GameObject by gameObject property. You must change for something like

  1. TweenAlpha.Begin(panelSplash.gameObject, 3f, 1f);

Sorry to say that. But it is very simple programing problem, an app could sove it automatically. If you don't study programing you will not go to far. And normally, nobody will answer these type of questions.

29
NGUI 3 Support / Re: Steps to switch HD/SD at runtime. Approved?
« on: August 23, 2013, 08:05:28 PM »
If the correct way is to use the  3 atlas as prefab. I must change the reference atlas prefab at runtime. I think that I misunderstood unity3d prefabs at runtime "readonly". But it make sense, at runtime, prefabs are simple gameobjects.

Forgot my item 4. It was to be "widgets point to empty atlas". But if I could point to the prefab, it is ok.

Thanks for clarification.

30
First you need to know where to search. You question by far is not a ngui question. NGui have documentation and videos how to create the inputs. Communication is a Unity problem, and the server is an php server.

Search in unity3d answers and you probably find something. I have already answers somthing about it (http://answers.unity3d.com/questions/490055/how-do-i-add-login-and-register.html).

Pages: 1 [2] 3 4