Pretty basic question but i can't seem to get it to work.
I want to change the material of an object when it's stored in the array safedArray. I also want the material to change back when it's not stored in the array anymore.
This is my basic c# function:
public void ShowMarker(bool show, string key)
{
// only stores are supported
var label = _city.FindStore(key);
if (!label)
{
Debug.LogError("No store with key '" + key + "' found");
return;
}
label.GetComponent().material = show ? _selectedMaterial : _normalMaterial;
}
It gets its arguments from this JavaScript-function:
mergeInto(LibraryManager.library, {
UnityReceivedTap: function (str) {
var safedArray =[];
var input;
input = Pointer_stringify(str);
if(input)
{
var receiverArray = input.split(';');
}
var storekey = receiverArray[0];
if(safedArray.includes(storekey))
{
SendMessage('NATIVE_BRIDGE', 'PostHideMarker', storekey);
safedArray.splice(storekey);
}
else
{
safedArray.push(storekey);
SendMessage('NATIVE_BRIDGE', 'PostShowMarker', storekey);
}
},
});
Changing the material is already working. Changing the material back is not and i don't really get why.
↧