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

Pages: [1] 2 3
1
Thanks yes my fellow programmer was having a similar issue and figured that one out.

but hey it is fixed and working now so woot!

2
NGUI 3 Support / Re: Weird Issue with Sprites (Urgent!)
« on: April 08, 2014, 12:24:40 PM »
I noticed.  Also my other developer was having a similar issue.  Yet found out when spawning NGUI objects to use localPosition to changed position as opposed to using position (which is only used for NGUI objects already placed in the scene.

3
Hi I am trying to spawn an NGUI sprite (not a NGUI Unity2D sprite) only when needed.  It for some reason normally spawns at (0,0,0) despite the prefabs set position.  So I set it in code and then gets a really weird position  as shown below in the picture.  Here is the code used:
  1. NGUITools.AddChild (panel.gameObject, mobFollower); // Spawn and add to panel so it shows up in the scene on top
  2. spawnedMobs.Add (GameObject.FindWithTag ("follower"));  // Add to list of spawned enemies for the current combat.
  3. Debug.Log ("Vector3 position of pfFollower (clone) was " + GameObject.FindWithTag ("follower").transform.position);
  4. GameObject.FindWithTag ("follower").transform.Translate (MOB1_POS);  // Place newly spawned object at the correct spot on the screen.
  5. Debug.Log ("Vector3 position of pfFollower (clone) is " + GameObject.FindWithTag ("follower").transform.position);
  6.  


As you can see the code console itself says the code worked, but the inspector tells a different story.  If I don't do anything it just spawns at center (0,0,0).

4
NGUI 3 Support / Re: Weird Issue with Sprites (Urgent!)
« on: April 06, 2014, 04:23:25 PM »
Ok I figured out the problem.  If I spawn the mobs parented to the panel then they appear on the game screen.  Which leaves one last problem how to get the instantiated object to spawn in the correct spot.

The prefabs transform is (275,-75,0) and yet when it appears on screen the objects the Objects Transform is (0,0,0).  I even tried to change it after the fact and it doesn't do anything.

  1. NGUITools.AddChild (panel.gameObject, mobFollower);
  2. spawnedMobs.Add (GameObject.FindWithTag ("follower"));
  3. GameObject.FindWithTag ("follower").transform.position = MOB1_POS;

I even tried it using the translate function
  1. NGUITools.AddChild (panel.gameObject, mobFollower);
  2. spawnedMobs.Add (GameObject.FindWithTag ("follower"));
  3. GameObject.FindWithTag ("follower").transform.Translate (MOB1_POS)

5
NGUI 3 Support / Re: Weird Issue with Sprites (Urgent!)
« on: April 06, 2014, 03:24:40 PM »
I think I see the problem.  The UI2Dsprite is being drawn and appearing under the camera in the hierarchy, but not under the panel.  Which is why it is being drawn behind everything.  At least I think that is the case.

Because I did a test with enemies that spawn and they also had the same issue until I dragged the object to under the panel and it suddenly appeared both in the editor and the game screen.  So I suppose the only question left is to how to make sure that happens with the player.  Unless since the player is a prefab for testing purposes in various scenes, if we do the same as with the follower it should in theory spawn appear in the same spot?

6
NGUI 3 Support / Re: Weird Issue with Sprites (Urgent!)
« on: April 06, 2014, 02:35:19 PM »
Ok I tried and changed it to UI2Dsprite, but now it is drawing on the very bottom despite being the highest depth in the hierarchy. (Considering that you are using the painter's algorithm for rendering Bottom (0) -> Top (n))

7
NGUI 3 Support / Re: Weird Issue with Sprites (Urgent!)
« on: April 06, 2014, 12:48:42 PM »
Yes I am aware but that doesn't plain why it shows up perfectly in the Main Menu screen.

8
NGUI 3 Support / Re: Weird Issue with Sprites (Urgent!)
« on: April 05, 2014, 02:02:14 PM »
Ok I did as you suggested but it did not solve the problem as seen below.


9
NGUI 3 Support / Re: Weird Issue with Sprites (Urgent!)
« on: April 05, 2014, 01:28:38 PM »
ok, if I had a much bigger screen I would do just that (Yet I don't have a 40" Monitor screen), but that doesn't really help the problem of why it is drawing in front in some scenes and not in others.

10
NGUI 3 Support / Re: Weird Issue with Sprites (Urgent!)
« on: April 04, 2014, 06:27:36 PM »
However when we get to the third scene, the player sprite is not shown in the game, but it is showing up in the scene window.  (ARG NGUI006 & ARG NGUI007)

I really not sure what is happening exactly and at a loss to how to even approach it.


11
NGUI 3 Support / Re: Weird Issue with Sprites (Urgent!)
« on: April 04, 2014, 06:25:10 PM »
Now as a test I ran it and had the sprite manually and it appears without issue in the first two screens of the game as seen below (ARG NGUI004 & ARG NGUI005).


12
NGUI 3 Support / Weird Issue with Sprites (Urgent!)
« on: April 04, 2014, 06:23:06 PM »
I'm having an issue and bare with me due to the posting limit it is going to have 2 replies under it.  Please note all included pics are running the game is running in the editor as this is when the issue is occurring.

I have setup the scene to show the character with the UI like in the NGUI example X (ARGZ NGUI001 & ARGZ NGUI002).  and in the editor it appears as it should.  Yet it does not show up as it should in game (ARG NGUI 002).




PlayerObject is a persistent from the moment the game starts up, but the sprite attached is invisible until need and code shows it when the scene above is started and hides it when it ends.

13
What exactly do you mean?  That is what the code above is trying to do and it is not working.  It might help if there was a visual reference to refer to.

14
Hi there, I know that you can do radio button root and it will affect multiple check boxes.  However I need to do it with multiple roots but not sure how to go about this.

For example if item 1 is checked, and the Item 3 is pressed and becomes checked, item 1 goes off, and if then item 5 is pressed, item 3 goes off.

My hierarchy looks like this
-UiGrid
  -Item1 (not a pane)
    - Checkbox
  -Item2 (not a pane)
    - Checkbox
  -Item3 (not a pane)
    - Checkbox
  -Item4 (not a pane)
    - Checkbox
  -Item5 (not a pane)
    - Checkbox
  -Item6 (not a pane)
    - Checkbox

yet RadioButtonRoot can only be attached to a single item.

I had tried to do this, but it does't do anything.
  1. void EquipAndy()
  2.     {
  3.         string itemId = AndysApplesAssets.ANDY_GOOD.ItemId;
  4.  
  5.         if (andy.equipCheck.isChecked)
  6.         {
  7.             if (!StoreInventory.IsVirtualGoodEquipped(itemId))
  8.             {
  9.                 StoreInventory.EquipVirtualGood(itemId);
  10.                 kelly.equipCheck.isChecked = false;
  11.                 ninja.equipCheck.isChecked = false;
  12.                 pig.equipCheck.isChecked = false;
  13.                 pirate.equipCheck.isChecked = false;
  14.                 wizard.equipCheck.isChecked = false;
  15.             }
  16.         }
  17.     }

Any and all help will be greatly appreciated.

15
NGUI 3 Support / Re: Rotating sprite not rotating visually.
« on: May 03, 2013, 11:51:02 AM »
OMG Nicki you hit the nail on the head.  Thank you for your quick and accurate and well worded response.

Pages: [1] 2 3