- Home /
How to set a variable on a drag and drop UI element.
I am using the example UI project to learn. I have 2 scripts, Dragme, and Dropme. I want to assign variables to each dragme object, and when i drag them and drop them on the object with the Dropme.cs script, i would like to change a variable in the animator. I don't know the proper way to do this. Any help would be appreciated. NOTE: I just have a public int MagicID declaired in dragme
public void OnDrop(PointerEventData data)
{
containerImage.color = normalColor;
if (receivingImage == null)
return;
Sprite dropSprite = GetDropSprite (data);
if (dropSprite != null)
receivingImage.overrideSprite = dropSprite;
Debug.Log ("Insert actions here");
Debug.Log (dropSprite.name);
//anime.SetFloat ("MagicID", 1);
}
Comment
Your answer
Follow this Question
Related Questions
How do I change the texture of a RawImage? 1 Answer
I have questions about ui linerender and linerender. 1 Answer
UI color issue 1 Answer
Instantiating UI? 0 Answers
UI element moves down when another UI elements gets too close? 0 Answers