UGUI Hide Icon

General support.
Post Reply
User avatar
nozzer007
New Member
New Member
Posts: 2
Joined: Thu Jun 16, 2016 1:33 pm

Hi,

Loving the UGUI Minimap, it's awesome.

Need some help though. I want to dynamically show and hide icons as the player reaches certain parts of the map. As the game starts I have referenced each of the items and called a script to run through the array of all the items and disable them as follows.

Code: Select all

	
	public void HideOnRadar(bl_MiniMapItem[] in_iconItems)
	{
		for (int i = 0; i < in_iconItems.Length; i++) {
			in_iconItems [i].HideItem ();
                }
	}
This works, and hides all of the map icons.

However, when I try to show a icon through scripting (below), the referenced icon does not seem to re-appear. I have debugged the code and stepped through it, and it successfully calls the ShowItem() method, and the cacheItem is not null, so it seems to set active as true, but on the Screen it does not reappear.

Code: Select all

	
	public void ShowOnRadarSingle(bl_MiniMapItem in_iconItems)
	{
			in_iconItems.ShowItem();
	}

Can you help.

Thanks,

Mark.
User avatar
Lovatto
Admin
Admin
Posts: 1834
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Hi.

Please try this:

Add this function in bl_IconItem.cs

Code: Select all

  public void SetVisibleAlpha()
    {
        m_CanvasGroup.alpha = 1;
    }
and in the script bl_MiniMapItem.cs modify this function: 'ShowItem()' with this:

Code: Select all

   /// <summary>
    /// Call this for show again the item in miniMap when is hiden
    /// </summary>
    public void ShowItem()
    {
        if (cacheItem != null)
        {
            cacheItem.SetActive(true);
            cacheItem.GetComponent<bl_IconItem>().SetVisibleAlpha();
        }
        else
        {
            Debug.Log("There is no item to active.");
        }
    }
Please tell me if this work for you.
Regards.
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
nozzer007
New Member
New Member
Posts: 2
Joined: Thu Jun 16, 2016 1:33 pm

Yes it worked perfectly, thank you for the super fast response!
Post Reply