How to make UI and Text effect in unity? - c#

I need to make my UI and Text appear like this in Unity
Kinda lost, don't know how to do this.

That is combination of two things:
Glowing image. Which move over button.
Button's image.
"Image Type": Filled.
"Fill Method": Horizontal.
and some other settings Here is the reference image.
Animations:
For animation of glow and image fill you could use unity animation and animator but i think that will be over kill for such process so i will suggest to use tween plugin like DoTween (My personal Best, Free), ITween (Free), HoTween(Free), Easy Tween(Not Sure) etc.
Arrangement:
Arrangement of this is easy and can be achieve like this:
Button game object having child game object with image component.
Then moving glowing game object over button.
If you need more information about animation and tween plugins or anything relevant to this then let me know...
I Hope this will help.

Related

Setting a button's alphaHitTestMinimumTreshold results into no call to Button.OnPointerDown

I want to create a button that has a custom shape in Unity.
I created a default UI>Button object and set it's Image to the following sprite:
It doesn't show it on this website, but the circle is the only part of this image that is transparent. It's a .png sprite.
When I set this as the sprite for my button, I could click on the entire rect transform of this sprite to activate the button using my button's OnPointerDown() method and un-hide some other sprites around it:
public override void OnPointerDown(PointerEventData eventData)
{
base.OnPointerDown(eventData);
Debug.Log("Foo");
}
Each time any part of the sprite was clicked, transparent or not, "Foo" would print.
Now I set the button alphaHitTestMinimumThreshold to 0.5:
GetComponent<Button>().image.alphaHitTestMinimumThreshold = .5f;
And as the docs suggest, I disabled atlassing...
...and enabled read/write for the sprite:
Yet now, when I click the button in my scene.. nothing happens. No matter where I click, "Foo" doesn't print anymore.
Then I tried changing the alphaHitTestMinimumThreshold to a lot of different values. Again, the entire button was not clickable anymore. If I don't touch the alphaHitTestMinimumTreshold at all however, my "Foo" prints again.
Why does changing alphaHitTestMinimumTreshold to any value make my OnPointerDown method to never be called?
So after 12 hours of messing around with all sorts of options, I found out that there were 3+ consecutive issues causing this behaviour.
If you ever run into your transparent buttons not working, be sure to try the following steps:
Make sure read/write is enabled in the texture import settings
Try if setting the Sprite Mode Mesh Type to Full Rect helps (sometimes the button's hitbox is off)
Disable atlassing under Project Settings > Editor > Sprite Packer > Mode
..and finally what did the trick for me: if you're working in a prefab that's nested inside another prefab (say your have a prefab for your button and then another prefab for your UI canvas/contents), remove the nested prefab from the parent prefab (aka remove the button prefab from the UI prefab), and just add it back in again. It was that freaking simple for me.
I triple checked whether my nested button prefab differed from the button prefab blueprint, and it didn't. But somehow, removing it from the UI prefab and adding it back in again solved my problem with a large sprinkle of magic.
With transparency buttons, I found that detection improves when the image is a child of the button object. So hierarchy is Canvas>Button>Image.
I know, old thread, but it came up so heres my solution:
It did all of the suggestions, but it didn't work.
HOWEVER,
What finally worked for me, was TO SPECIFY THE RIGHT SIZE. My game Object was elongated, but the sprite had "preserve aspect ratio" ticked. I just didn't bother to size it properly.
So when you have an image, set the size of the gameObject to the right dimensions.

Create a slash effect using image and progressively drawing

What I want
To create an effect like an slash in my 2D project. For that, I've an image in my assets already, and I want to draw it from top to the bottom, allowing it to be drawn in maybe half a second, progressively.
The idea is to draw it to create the effect of the slash itself, and the progressively mode is to "fit" the slash image itself, imagine the first one of the following link, that would be drawn from left to right.
To achieve that kind of drawing, the only thing that I've found is fillAmount for an Image, combined with the fillMethod.
The problem
The problem is that these methods are for the Image class, that it's not recommended for game drawing but only for UI.
Anyway, I've tried to do it this way, and I've not been able to do it, because the Unity environment didn't let me drag&drop my slash asset into the Image variable that I had created into my script. I thought that it may be because of the type of import, but also trying to import it with the other options resulted in nothing better.
The questions
Just answering one of these questions would solve my situation (or I think so):
How can I make Unity accept my image/asset into my Image object in the script?
Another way to create such effect using Sprite or GameObjects directly?
Method 1: You can use sprite sheet to create a 2D animation
1-1. Prepare a splash effect sprite sheet (an image map contains continuous action image), like
1-2. Change the sprite mode to multiple in inspector window
1-3. Slice the sprites in sprite editor
1-4. Multi-select the sprites and drag into hierarchy window, Unity will ask you to save this animation
1-5. You will get an animation GameObject
Method 2: If you can make it like a circular progress bar, check Radial/ Circular Progress Bar in unity3d

How to control Unity Animation?

As far as I know, there are ways to manage Animation
Immediately,
Managing in the form of objects.
Managing with Sprite Images.
Is it effective to manage animations
in object format to manage character's joints in 2D animation?
What should I do to make it easier for me to understand Unity Animation?
As a beginner, we need a lot of data. I need your help. Help me.
I am going to explain the animation by manipulating GameObjects.
You need to add an Animator component to the GameObject you wish to animate. The animator component needs an animator controller. You also need to create an animation clip which represents an animation.(Animation controller is automatically created when you create an animation clip)
Now, to get started with animation you need to focus on animation clips. After you add an animation clip, you can record an animation into it. You do this by hitting the record button in the Animation window. While recording, any changes made to the GameObject will be recorded into the animation clip. (For example, you might move your GameObject). Any such change will create a key frame in the Animation timeline. The time point where key frame should be created can be changed.
Unity will interpolate the changes between two keyframes automatically.
However, there is also an animation curve which allows you to define how changes are applied between time points.
After you record animations you can define how transitions between different animations are made in the Animator Window.
unfortunably I am not really sure what your question is about?
For question this might be helpful:
https://www.youtube.com/watch?v=PuXUCX21jJU
Usually you have a Image File with the animation movements of your 2D Image object and using the "Sprite Editor" to cut them out for Unity.
You then add this Clip on a Animimation Component to be added to your "GameObject".
Since this is a "C#" question, maybe you want to know how to access this Compnent. The best is to use it in the "Init()" and add:
var anim = GetComponent();
Now you can use the "Animation" Component to play the configured Animation Clips.
I hope this helps you a little bit.

C# - I am trying to create a grid lock game and I need your assistance

Since I don't have 10 reputation to post an image, I am going to leave a link of the game picture. http://thinkfun.com/mathcounts/play-rush-hour
This is what I want to create. A game where a rectangle must pass through other rectangles through the hole to win the game. The main rectangle can only move forward and other rectangles can move either right, left, up or down depending on their position. You must move the other rectangles in a way that they could make a way for the main rectangle to pass.
Here is my plan how I am going to create this game:
Create all the forms, import all the images and graphics to get ready to work with them.
Write code for 1 rectangle that would be able to move around.
Write an algorithm that wouldn't allow for rectangles to go through each other.
Make a winning hole.
Code other rectangles, make a full game.
Make fancy animations.
Import statistics : score, move counter and etc.
Here are my questions that I wanted to ask before trying to develop this game.
(Oh, and by the way, I am using Visual Studio C# form )
I assume that these rectangles are not going to be buttons, then what kind of a "button" (or whatever you call those extra features ) should I use?
How do I make a skin for those rectangles? So I can make it look like wood and make a nice skin for the main rectangle.
These are all my questions so far. I would like to know how to overcome those problems and I would like to hear some extra tips. Thank you very much for your time!
Use Graphics to draw your rectangles. Else make an object to hold info for it and you can import an Image as your "skin".
See number 1.
First off: Do you want to create a game or learn winForms? If the answer is create a game. Chose a Game Engine (Unity is nice, and uses c#) and work with that instead.
If you want to learn winForms you'd probably want a PictureBox, then add your code your code in OnMouseUp, OnMouseDown, etc. Good luck :)

Expression blend for animations

I am trying to create a short animation of an object rotating in 3D space..I have all my images ready..I would like to know how I can change from one image to the other without the transition moves being shown
Thank you
Edit: What i mean is that instead of having a bouncing ball which all i need to do is move the ball in each frame, what if i had and object that in every frame I used a different image: eg. person facing forward, person facing facing right, etc...how can i do it without the image being shown as being dragged from the screen?
I hope I'm making sense
I whant to advise you look at Principles of Microsoft Silverlight Animation video by Jeff Paries on mix09. I shure it usefull and comprehensive overview of Silverlight animations.

Categories

Resources