Topic: Activate / disable buildings

Hi
I started to use the OnlineMapsBuildings component.

What i want to achieve is basically being able to activate / disable the buildings at runtime.

I tried to disable the OnlineMapsBuildings script of the map but it does'nt get rid of the buildings.

i tryed to delete manually the buildings with

foreach (OnlineMapsBuildingBase item in OnlineMapsBuildings.instance.buildings.Values)
{
      Destroy(item.gameObject);
}

But they keep coming back !

Is there a way to achieve this ?

Re: Activate / disable buildings

Hello.

To disable buildings, you just need to disable Online Maps Buildings component.
I just checked it and it works correctly.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Activate / disable buildings

I tryed a few things.

Test A :
- the Online Maps Buildings component is enabled before launching app
- i launch the app
- i disable the Online Maps Buildings component via code directly in a Start() method
- later i will enabled the component via code
-the buildings appears correctly
- i disable the component again
- the buildings does disappear
- after half a second the buildings are back in the scene. sad

Test B:
- the Online Maps Buildings component is disabled before launching app
- i launch the app
- later i will enabled the component via code
-the buildings appears correctly
- i disable the component again
- the buildings does disappear, and they don't come back until i enable the component again smile

The reason i was going for test A is that i was trying to enable / disable the component by doing :

public void use_Buildings(bool b)
{
     OnlineMapsBuildings.instance.enabled = b;
}

And this throw an error since the onlineMapsBuildings instance does'nt exist yet if i launch the app without it being enabled.

using this :

public void use_Buildings(bool b)
{
     OnlineMaps.instance.GetComponent<OnlineMapsBuildings>().enabled = b;
}

Allow me to do "test B" and so my problem is solved.

Note that in both case, a new gameobject named "buildings" (which become the parent of all the buildins) is created each time i enable the component.

https://i.imgur.com/KzXYUVw.jpg

Hope this feedback is usefull wink

Re: Activate / disable buildings

I repeated both of your tests several times, and could not reproduce the buildings that appeared.
Perhaps the problem requires some additional condition.

The problem with duplicate Buildings GameObject is fixed.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!