Hello goodday,
I have a question. I have a button with a script and i want when i click the button that a value changed in another script. This is my button script:
I get this error:
Assets\Scripts\Remove_Layer.cs(16,18): error CS1061: ‘ArcGIS_map’ does not contain a definition for ‘laag_1’ and no accessible extension method ‘laag_1’ accepting a first argument of type ‘ArcGIS_map’ could be found (are you missing a using directive or an assembly reference?)
I think the remove script can’t find the var laag_1.
Ok, so not only is laag_1 private by default, meaning no other scripts can access it, you made laag_1 a local variable, being made within a function, never to be used again, all that ignoring the fact that it doesn’t even have a type of which to draw the float “Opacity” from! If you want to change it from another script, you need to have it be non-local, public, and you need to specify the type of variable it is. Though ignoring that for a sec, if you are using buttons from a canvas, you shouldn’t even be using a script, as (I’m pretty sure) you can do all that from the “OnClick” part of the button component, and even if you can’t, it wouldn’t be that hard to just make a public void with an input to do just that. If you need info on how to do that, let me know.
Hello thanks for your answer! I’m just a very beginner and i use this script that i find online. The map works, but i wan’t the possibility to remove a layer in play modus.
But laag_1 is in a public CreateArcGISMap or i’m looking wrong?
Below var laag_1 there is also arcGISMap.layers.Add(laag_1) that add the layer. And in stead of changing the Opacity it is better to use a script with this: arcGISMap.layers.Remove(laag_1).
I wan’t to use this script in a OnClick of a button. Because i need to add a function to the OnClick button function.
Can you help me with making the script to remove the layer?