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 - firestorm

Pages: [1]
NGUI 3 Support / wrap content scroll view Transform error
« on: November 12, 2015, 03:08:21 AM »
I have a store set up that is just items in a scroll view. I want to delete the item if the player owns that item already. The issue is I get this error when you attempt to scroll through the items after them being deleted

MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
UnityEngine.Transform.get_localPosition () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineTransformBindings.gen.cs:34)
UIWrapContent.WrapContent () (at Assets/NGUI/Scripts/Interaction/UIWrapContent.cs:180)
EventDelegate.Execute () (at Assets/NGUI/Scripts/Internal/EventDelegate.cs:476)
EventDelegate.Execute (System.Collections.Generic.List`1 list) (at Assets/NGUI/Scripts/Internal/EventDelegate.cs:644)
UIButton.OnClick () (at Assets/NGUI/Scripts/Interaction/UIButton.cs:248)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
UICamera:Notify(GameObject, String, Object) (at Assets/NGUI/Scripts/UI/UICamera.cs:1469)
UICamera:ProcessRelease(Boolean, Single) (at Assets/NGUI/Scripts/UI/UICamera.cs:2325)
UICamera:ProcessTouch(Boolean, Boolean) (at Assets/NGUI/Scripts/UI/UICamera.cs:2375)
UICamera:ProcessMouse() (at Assets/NGUI/Scripts/UI/UICamera.cs:1830)
UICamera:ProcessTouches() (at Assets/NGUI/Scripts/UI/UICamera.cs:1943)
UICamera:Update() (at Assets/NGUI/Scripts/UI/UICamera.cs:1631)

I have attempted to run the WrapContent() after deleting the item and the scroll views ResetPosition() with same results

any help would be appreciated

NGUI 3 Support / News Feed Scroll View
« on: July 17, 2015, 01:21:04 AM »
I have a news feed that downloads the latest news from a server. The issue I have is how to get it so the news feed scroll view starts at the top. Currently when it loads it loads at around the middle section of the news. I have attached the screen shot, All it is is a scroll view and label. I cant simply move it into position as the news will change all the time

That was the solution we were going to go with, the issue ended up been on the Facebook SDK side and had nothing to do with NGUI.
The issue was working out when the facebook UI was on screen.

So, if anyone else runs into this issue.
The fix was to use a callback from FBResult. A complete oversight on my behalf when learning about the facbook SDK.
For example I had to set up a function like this.

  1.  void LogCallBack(FBResult result)
  2.      {
  3.          if (result.Error != null)
  4.          {
  5.                  Debug.Log("ERROR IN FEED");
  6.                  sm.butCover.SetActive (false);
  7.          }
  8.              else
  10.              {
  11.                  Debug.Log("SUCCESS IN FEED");
  12.                  sm.butCover.SetActive (false);
  13.              }
  14.          }

And then at after you call your FB.Feed you use the callback which sends information back regarding the facebook UI (from my understanding)

  1.  else
  2.          {
  4.              sm.butCover.SetActive (true);
  5.              FB.Feed (
  6.              linkCaption: "", //share with friends at anytime.
  7.              picture: "", //http to game icon to be shown on facebook.
  8.              linkName: "", //just the name of the link
  9.              link: "" + FB.AppId + "/?challenge_brag=" + (FB.IsLoggedIn ? FB.UserId : "guest"),
  10.                  callback: LogCallBack
  11.              );
  12. }

So if you press share or cancel it will indicate that the callback was a success.

FYI sm.butCover.SetActive is just a panel that covers the screen which I am turning on or off to block interaction with the game while the FB UI is up on screen.

I'm running into an issue where you are still able to interact with NGUI buttons while the post to facebook dialog box is open.

Unfortunately there is nothing in the hierachy that facebook creates while this dialog box is open so i am unable to do a simple if ... is there then change alpha.

The only thing i can see that facebook adds is under the hierarchy it creates a UnityFacebookSDKPlugin and in that inspector a feed dialog will appear. Screenshot provided.

It seems to run off a .dll file so cant do simple if statements there.

We can disable the buttons after you click share but have no way of re enabling them once the user has shared or cancelled the post.

If there is a way to get component of the feed dialog that would work nicely but a simple getcomponent<FeedDialog> doesnt work

So im working on a 2d game and am stuck on a few things

Some questions first

1) Does every game object in the entire game need to be under the ui root and have a widget for layering?

2) How do I make gameobjects appear infront. (Example, I have some background sprites but some gameobjects seem to get lost)

things that are specific to my issues

I created a pause menu that I need to show above the other gameobjects etc in scene so to obscure peoples view. First I have a pause menu empty game object inside that i have buttons and a background. The problem is I can work out how to get the pause menu above other game objects no matter if the widget is higher than all other objects. I can also interact with the gameobjects underneath the pause menu sprite

I was having issues interacting with other game objects so any game objects that aren't apart of the ngui system I spawn on -1 z axis.

I have uploaded a screenshot of the menu disappearing even in the scene view

NGUI 3 Support / Re: UICenterOnChild.centeredObject example
« on: March 25, 2015, 06:36:51 PM »
I just wanted to show people how I got mine to work for others in the future

  1. using UnityEngine;
  2. using System.Collections;
  4. public class selectBackgroundScript : MonoBehaviour {
  5.         public UICenterOnChild backgroundRef; // drag the object that has the centeronchild script attached in my case it was the grid
  7.         public void Update()
  8.         {
  9.                 if ( == "grassBackground")
  10.                         grassBackground ();
  11.                 else if ( == "picnicBackground")
  12.                         picnicBackground ();
  13.                 else
  14.                         kitchenBackground ();
  15.         }
  17.         public void grassBackground()
  18.         {
  19.                 UISprite sprite = GetComponent<UISprite> ();
  20.                 if (sprite.spriteName != "Grass_Background")
  21.                 {
  22.                         sprite.spriteName = "Grass_Background";
  23.                 }
  24.         }
  26.         public void picnicBackground()
  27.         {
  28.                 UISprite sprite = GetComponent<UISprite> ();
  29.                 if (sprite.spriteName != "Picnic_Background") {
  30.                         sprite.spriteName = "Picnic_Background";
  31.                 }
  32.         }
  34.         public void kitchenBackground()
  35.         {
  36.                 UISprite sprite = GetComponent<UISprite> ();
  37.                 if (sprite.spriteName != "Kitchen_Background")
  38.                 {
  39.                         sprite.spriteName = "Kitchen_Background";
  40.                 }
  41.         }
  43. }

NGUI 3 Support / UICenterOnChild.centeredObject example
« on: March 25, 2015, 01:13:42 AM »
Hi i was looking for an example on how UICenterOnChild.centeredObject works.

Here is my setup

on my grid I have the UI Center on child script
under that I have 3 labels (easy, medium, hard)

so I now need my button that starts the game to get what label is selected.

If I could just get an example script on how the centeredObject worked would be helpful

Thanks ;D

Pages: [1]