By default in the picture above, the green box(drag target) is empty. When the red box(A) is dragged is stays in the green box and then this red box (now inside the green, also acts as a drag target). So that now the black box(B) can be dropped into it. How do I do this in flutter With Draggable and Drag target. Thanks in advance.
I think you need to use gesturedetector(tabdowndetails) to detect "x,y" while moving users finger across the screen. You can paint target rectangle(const dimensions) dynamically following users finger.
btw. where do you plan to drag the boxes(objects, picts)?
Related
I'm working on my game and I want to add an inventory type system, when I added the panel it was a little transparent while the one in the video was watching was not. I didn’t see any setting for transparency in the Unity inspector for both the canvas and the panel. The UI mode is an overlay
I didn’t try much other than clicking all the check boxes, and I was excepting for the up to be a solid color.
If you have a Canvas Group in your hierarchy, it can come from here (Alpha property).
I needed to go to colors and slide this slider all the way up or down (the slider you need to change)
I have an Android application with some draggable elements.
There are some some labels that I want do drag over containers. The moment I drag over the container, I want the container background to change its colour.
I am unable to achieve this with DragOverListener from the API.
This is my code:
label.addDragOverListener(l -> {
container.getAllStyles().setBgColor(ColorUtil.YELLOW);
container.getAllStyles().setBgTransparency(255);
});
What happens is that as soon as I start dragging the label, the container changes the colour. But that's not what I want. I want the container to change the colour only when I drag over it.
Is there a way to achieve this?
Many thanks in advance.
The event delivers an X/Y location for the drag which you can use to determine whether to draw the color or not. Generally, this API is designed for refined drawing of this type e.g. drawing a square in the place the dropped component will occupy.
Hi I am trying to create custom buttons on unity (trapeziums). I successfully created the visible area on Photoshop and imported it as Sprite 2D UI as per the following image:
The issue arises, when I'm trying to select one of the buttons in game, their border overlap each other, since the transparent area is still being considered as part of the clickable button area. How can I remove this?
EDIT:
Practically when I import I want the squared boxes to not be counted with the image. I need the edges of the orange area to be cut flush with that and not the entire area(i.e. including the transparent boxes).
You may achieve this by using Alpha Hit Test Minimum Threshold. Take a look at this nice video tutorial.
There is one extra step that is not shown in the video but mentioned in the comments: you have to change "Mesh Type" to "Full Rect" and not "Tight" as it is.
Hope that helps.
The clickable area is based on the Rect Transform component of the GameObject. Adjust the width and height to the clickable area you want. You may have to crop your image in photoshop accordingly. If you select 'Gizmos' in the editor you can toggle viewing the click region.
I've tried deactivating lights & light probe icons but this yellow lines and grey spheres keep appearing every time that i click an object.
I can hardly see the objects that im placing with that sphere overlaping them.
In the editor window there is a drop down menu named Gizmos in the top right corner. Click on it and unselect LightProbeGroup to hide it.
I am working on a project in unity5, while I am making a menu contain buttons, I need button to make glowing outline, need help in this regard.enter image description here
same in the picture, I need button like this in my Unity 5
if you are using canvas you can do that without using any functions or events it can be easily done select button in inspector you will see button (script) component set transition to sprite swap and drop the desired sprite in pressed sprite box.