Issue with animating ui elements in unity 3d - animation

I've added an animation clip to a canvas which animates position and alpha channel of its children (like buttons etc.). Now I'm gonna play this animation via pressing the play button (one of itself's children) as shown as here:
(Click om images to see in full screen)
I created a trigger in mecanim and sat as the trigger of transiting to that animation but it didn't work. Is there any ways else or was my job correct and did I some mistakes?
Please help, thanks

In the animator window just making the trigger doesn't do anything. You need to set the trigger by getting a reference to the animator and calling SetTrigger("yourTriggerName"). You can call this in the inspector using the UI button's OnClick() method.
Go to the inspector for the play button and scroll down to where you see this:
click the plus sign and then drag the game object with the animator you want to trigger onto the field that says None(Empty) then select the animator from the drop down menu that appears and select the SetTrigger function. Then type in the name of your trigger Exactly. Upper case matters. That's it. It should look something like this when you are done:
Obviously, you will have to use the correct GameObject and trigger name so yours will look a little different.

Related

Unity UI Button not calling the Onclick method

I have a button under a canvas that is suppose to restart the scene. But instead its not calling the intended function of attached script.
On Unity Forums, I found solutions like it should be at higher hierarchy in canvas, and the canvas should have a graphic raycast and so-on.
But it still isn't working, although its on click array detects the intended method it is suppose to call.
Scene Editor with Canvas Selected:
Scene Editor with Button Selected:
Remove the canvas component from your button.
Make sure that there is a GraphicRaycaster on your canvas, and that there is an EventSystem object somewhere in the hierarchy.
(Both should have been added when you first added the canvas, but things get lost)
The screenshot that shows your button being selected, also shows, that you did pick a gameobject for the OnClick event, but you didn't pick a function from the drop down right next to that field, it says no function.
Instead of selecting the C# class, select the GameObject that
btnSceneSelect is attached to.
If btnSceneSelect is not attached to a GameObject, attach it to one
(other than the button).
Taken from this site

How can I edit an animation in Unity3D

I have selected a game object in the Hierarchy with an animation component attached (not an animator but a simple animation) then I tried to open the animation window to edit it by choosing "Animation" from the "Window" menu. The problem is that the animation window is grayed out and it suggests that I create a new animation. But I just want to edit the one that I already have.
To edit the animation, you need to select a GameObject, make sure it has an Animation component in the inspector or add it if not, assign the animation in question to the Animation list of that component, then open the animation window and select your animation. it's under the time control buttons, beside the object popup.
Source: http://answers.unity3d.com/questions/205198/edit-animation-in-animation-windows.html
I have just found out why it didn't work. Because the animation component provides a list of animations, and the first element of the list should not be empty. Meanwhile in my case the first element of the list was empty and the animation I wanted to edit was assigned to the second element of the list. That's why it didn't work.
The "Animations" tab under the "Animation" component must have 1 animation under it, including blanks. To fix this, change the "size" to 0, and the animator at the bottom will open.

NSTextField dragging values

I am trying to create a text field in the Mac OSX environment that allows a user to select a number and drag horizontally to adjust that number up and down.
I know this can be done because Apple have implemented it in the inspector panel of the Sprite Kit emitter section: see the image
I have tried sub classing NSTextField to capture mouse drag events and doing the math, but they don't seem to get passed through. The mouse down event does though...
I have also tried placing a dummy view over the top and catching events as they come through. This works for mouse down, but again, the mouse dragged is never called. I know that the view can receive the mouse dragged event though, because if I place that view somewhere that a text field isn't under it, everything works fine.
What are my options here? I feel I have tried everything and the only option left is to create a new control from scratch. I don't mind that too much, but I also want the user to be able to add equations in the text field and drag individual values - that means the full functionality of NSTextField will need to be rebuilt just to add this dragging feature... Is there anything else???

Rollover image PowerPoint

Is any change to obtain a rollover image effect on a single slide ? I mean whitout using custom show or hyperlink to another slide.I'am using PP 2010.
I was think at something like to hide an image behind another and on mouse over first image bring to front the second...but I don't found anything about this on the internet.Does anyone know any other solution?
Two ideas how to approach this
Create Shape1 and Shape2 at the same position. Add a show animation to Shape2 that is triggered by a click on Shape1
Create an action button that triggers a macro on mouse-over that will change the appearance of the button or makes another shape visible.
However, I am not sure if there is a way to reverse the effect.

How does the Outlook app delete checkbox UI xaml code work?

If you tap on the left hand side of the screen in Outlook then an event is triggered (in this case a checkbox appears).
I would like to know the xaml on how this is achieved. It cannot be a simple "MouseLeftButtonUp" event because if you drag your finger more than a few pixels then the event does not trigger.
In my own app I am trying to get an icon appear within a listbox that has a SelectionChanged event. The issue is that if you do not touch the small icon precisely then you are triggering the listbox event rather than the event I want to occur when pressing the image.
I think I need to wrap my image in a Canvas but then am still stuck as to what the event should be.
How do you increase the target size of the area where a user can click on your element?
What event should an image have when within a listbox (which is within a pivot) that has a SelectionChanged event? (MouseLeftButtonUp causes issues if you half drag to the next pivot and lift your finger - it triggers the MouseLeftButtonUp event)
I implemented something very similar to that behavior by making an itemtemplate where the checkbox was pushed offscreen to the left by using a negative margin.
I then created 2 visual states, one for Open and Closed. The open state set the margin to 0, bringing the checkbox back onscreen. Closed state had the negative margin.
With the fluidmove behavior, switching between states on button press was EASY. The only thing you'd have to add would be an invisible button/touch area on the left that would also trigger "opening" the checkbox column (changing state to reset the margins).
Hope that helps...
The outlook app is a native app, so it probably isn't using xaml at all.
If you're worried about the mouse events, then you should look at the gesture stuff in the silverlight toolkit, it contains tap, etc events that make a little more sense on the phone.
Increasing the target size and generally making stuff touchable: wrap it in a Button, then alter the ControlTemplate for the Button to remove the border.
If you look at the ControlTemplate for a Button, (Expression Blend, Edit Template, Edit a copy) you'll see the mechanics of the touch area. It's nothing more than padding/margin.
Thus, you can't bleed your touch region out without altering the layout and affecting other items around the control. I'd do two things:
First, I'd think about whether my whole control should be larger in the first place with good spacing around it. Is my design right?
Second, I'd cheat. I'd float a fixed sized button with no border over the area using the Translate transformation to move it around freely.
Good luck,
Luke

Resources