- Home /
Is there a way to make something not draggable
So im making a card game and I want it so that the computers cards cannot be draggable, now im sure i shouldnt make an enemy set of cards, so im wondering is there a way make a card "undraggable". for context im using the Idrag interfaces.
Answer by xxmariofer · Feb 03, 2019 at 08:48 PM
adding a tag to the enemy cards and the OnDrag just compare if its an enemy tag doesnt work?
yep, or just have a variable (enum if the number of players is fixed, int otherwise) to know wich card is from wich player, on the card script.
yep, but it just send the message, you need to change position on the script, like this example
public void OnDrag(PointerEventData eventData)
{
transform.position = Input.mousePosition;
}
so you can put a if there
enum Side {Us, Enemy};
public Side CardSide;
public void OnDrag(PointerEventData eventData)
{
if (CardSide == Side.Us)
transform.position = Input.mousePosition;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612191034im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Drag and Drop on RTS camera 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How do i check if correct image is dragged in the panel?? 0 Answers
Game object z axis makes object not line up with parent 1 Answer