playMaker

Author Topic: NGUI possible problem causing crash[SOLVED]  (Read 6799 times)

Splankton

  • Sr. Member
  • ****
  • Posts: 268
NGUI possible problem causing crash[SOLVED]
« on: April 14, 2014, 03:01:20 PM »
Hi,
Im using ArrayMaker to instantiate a prefab at start which works fine in the editor, but when I build it to a mobile device, it crashes.  I've ran the profiler and it does look like its at the moment when it instantiates.  Its only 20 items, so I dont understand why its ok in the editor when I run it, but not when its built to a mobile?
« Last Edit: April 18, 2014, 03:24:32 PM by Splankton »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: ArrayMaker possible problem causing crash
« Reply #1 on: April 15, 2014, 10:10:29 AM »
Hi,

-- Are you not looping the creation process somehow? or something like that?

--What is the log telling you? what does the crash log tells you? Is it IOS or android?

-- Do you get an error within Unity or a warning?

-- what are you doing with ArrayMaker?


bye,

 Jean

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: NGUI possible problem causing crash
« Reply #2 on: April 15, 2014, 03:56:11 PM »
Hi,

-- Are you not looping the creation process somehow? or something like that?

--What is the log telling you? what does the crash log tells you? Is it IOS or android?

-- Do you get an error within Unity or a warning?

-- what are you doing with ArrayMaker?


bye,

 Jean

--I've checked the looping, as far as I can tell, its fine.  I have it looping 20 times then finishes.

--The log is strange.  I'm getting !query->pending.  A lot of them.

--It's on Android.

I've just ran the Array on its own in its own scene and it doesnt crash. So, I'm looking at NGUI. I think its that.
Are there any known issues using NGUI on Android?

Bjakuja

  • Junior Playmaker
  • **
  • Posts: 75
Re: ArrayMaker possible problem causing crash
« Reply #3 on: April 16, 2014, 02:55:02 AM »
HI, you are instantiating 20 items at the same time using Array Maker right? Well if that's the case than Unity can cause some problems cause creating objects has impact on performance in Unity. Instead of creating objects can you add your objects to the scene and on game start just loop through your items and activate them instead of creating them, it's easier for system to do that than creating. Instead of creating / destroying you can activate / deactivate objects. Is it possible to that with you game or? If you have many items and want to choose 20 to be activated you can hide all items, loop through them and check for conditions, activate desired items and skip undesired, does this make sense to you?

Cheers!!!

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: ArrayMaker possible problem causing crash
« Reply #4 on: April 16, 2014, 02:12:25 PM »
Yes it makes sense, thanks for the help.
By the way, I get these ArrayMaker errors after running on the device:-

 Assets/PlayMaker ArrayMaker/__internal__/Editor/PlayMakerCollectionProxyInspector.cs(342,121): warning CS0618: `UnityEditor.EditorGUIUtility.LookLikeInspector()' is obsolete: `LookLikeControls and LookLikeInspector modes are deprecated.'

Assets/PlayMaker ArrayMaker/__internal__/Editor/PlayMakerCollectionProxyInspector.cs(352,113): warning CS0618: `UnityEditor.EditorGUIUtility.LookLikeInspector()' is obsolete: `LookLikeControls and LookLikeInspector modes are deprecated.'

Assets/PlayMaker ArrayMaker/__internal__/Editor/PlayMakerArrayListProxyInspector.cs(20,22): warning CS0618: `UnityEditor.Undo.RegisterUndo(UnityEngine.Object[], string)' is obsolete: `Use Undo.RecordObjects instead'

Assets/PlayMaker ArrayMaker/__internal__/Editor/PlayMakerArrayListProxyInspector.cs(149,97): warning CS0618: `UnityEditor.EditorGUIUtility.LookLikeInspector()' is obsolete: `LookLikeControls and LookLikeInspector modes are deprecated.'

Assets/PlayMaker ArrayMaker/__internal__/Editor/PlayMakerHashTableProxyInspector.cs(20,22): warning CS0618: `UnityEditor.Undo.RegisterUndo(UnityEngine.Object[], string)' is obsolete: `Use Undo.RecordObjects instead'

Assets/PlayMaker ArrayMaker/__internal__/Editor/PlayMakerHashTableProxyInspector.cs(123,97): warning CS0618: `UnityEditor.EditorGUIUtility.LookLikeInspector()' is obsolete: `LookLikeControls and LookLikeInspector modes are deprecated.'

Any ideas how to fix them?

Also Jean, I'm still getting the crash. I know now its NGUI related NOT ArrayMaker :)
The game runs for about 3 seconds then crashes. If I disable the FSM that receives a Button from NGUI, it runs fine.
All I have in the FSM is 2 Globals,

NGUI/OnPressDown
NGUI/OnPressUp

I've updated NGUI, also downloaded the latest PlaymakerNGUI addon, checked I have a working Button (which works perfect in the editor) so Im lost why it crashes on my Android device.

Can you help?



jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI possible problem causing crash
« Reply #5 on: April 17, 2014, 02:10:44 PM »
Hi,

 These are not errors, and do not affect the game at all, It's going to be addressed on the next release of arrayMaker, but that's not going to help you here, the problem is elsewhere, and I would say not even with ngui, but actually with what you do when the user press that button, and indeed re the 20 prefab instanatiation:

-- try using a pool framework, always better then manual instantiation.
-- try dto instantiate just 1, and see if it crashes.

bye,

 Jean

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: NGUI possible problem causing crash
« Reply #6 on: April 17, 2014, 03:07:51 PM »
Alright, thanks Jean!
Im using the pooling idea and getting better performance now ;)
 
Regarding the crash I get, I have removed the NGUI function I was using and replaced it with the button from the PlayMaker NGUI samples. And, it didnt crash! But! for some reason, it disappears after like 3 seconds.
I have the main camera at depth 0, the UI camera for the button on depth 1 (clear flags depth only) I dont know if its camera related, but its strange how it appears on start fully working, but disappears (even if its not pressed)
And this is all on mobile.  In the editor, it doesn't disappear.
Any ideas why this happens?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NGUI possible problem causing crash
« Reply #7 on: April 18, 2014, 07:09:36 AM »
Hi,

 if it dissapear after 3 sec, something is playing on this, maybe a tween or a logic somewhere you did not expect to kick in.

bye,

 Jean

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: NGUI possible problem causing crash
« Reply #8 on: April 18, 2014, 03:23:29 PM »
Yea, I don't know what was causing it, I just disabled my main camera and tried a build with just the UI camera, that worked fine, so I activated the main one again and it's now all working. Strange  ???
Thanks again Jean. Running silky smooth now.