Author Topic: Water mask could not be loaded  (Read 15 times)

yellowBeatle

  • Newbie
  • *
  • Posts: 4
    • View Profile
Water mask could not be loaded
« on: May 03, 2021, 11:21:33 AM »
Hi I'm new to thw World Map Strategy Kid and I'm trying to instantiate some units in an specific location. I want to deploy my units in the Spain provinces. I've been investigating and it seems I need to use the function WMSK_MoveTo but when I do so I get theses two errors:
Water mask texture could not be loaded UnityEngine.Debug:LogError(Object) WorldMapStrategyKit.WMSK:CheckRouteWaterMask at Assets/WorldMapStrategyKit/Scripts/Core/Internal/WMSKPrivPathFinder.cs:80)
NullReferenceException: Object reference not set to an instance of an object WorldMapStrategyKit.WMSK.ContainsWater (UnityEngine.Vector2 position) (at Assets/WorldMapStrategyKit/Scripts/WMSKEarth.cs:346)

I haven't touched any asset inside the plug in. Any idea of what it could be?

Thank you

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 6981
    • View Profile
Re: Water mask could not be loaded
« Reply #1 on: May 03, 2021, 11:30:59 AM »
Hi,

Assuming you're using the viewport mode, this simple code should work out of the box:

1) Create an empty scene.

2) Select top menu Game Object -> 3D object -> World Map Strategy Kit Viewport (this will also create the base map gameobject)

3) Add the script below to an empty gameobject in the scene

Code
using UnityEngine;
using WorldMapStrategyKit;


public class Test : MonoBehaviour
{
    public GameObject prefab;

    void Start()
    {
        GameObject o = Instantiate(prefab);

        WMSK map = WMSK.instance;
        Vector2 location = map.GetCity("Seville", "Spain").unity2DLocation;
        o.WMSK_MoveTo(location);
    }
}

4) Assign the tank prefan from demo folders (Demos/Resources/Tank/CompleteTank) to the prefab field of the above component in the inspector.

5) Run the scene.

The tank should be positioned on Seville.

The scaleOnZoom parameter is true by default. You can set it to false in the WMSK_MoveTo() call to keep the tank size regardless of zoom level.



Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 6981
    • View Profile
Re: Water mask could not be loaded
« Reply #2 on: May 03, 2021, 11:34:08 AM »
In addition to the above test code, make sure the Water Mask field has a water mask assigned:



(You can use the WorldMapStrategyKit/Resources/WMSK/Textures/EarthScenicPlusMap8K texture for the water mask).

yellowBeatle

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Water mask could not be loaded
« Reply #3 on: May 13, 2021, 11:53:56 AM »
Thank you a lot for the quick response. It was really helpful ;D