I want to use Events in my animation ( my animation is part of my .fbx file which is exported from 3d studio nad I imported to Unity 5.3 ) to change behavior of my character like in http://docs.unity3d.com/Manual/animeditor-AnimationEvents.html
but I don't have Events option like in tutorial and when I click double on any moment in timeline no new event is created.
How to add Events option to animation ( I know how to add callbacks once I have option for events from previous tutorial )
Animation events have to be added in the "Animation" window (not "Animator"). Open it, then select a GameObject which has the AnimationClip you want to add events to (can either be GameObject with an Animator or with an Animation component).
You should now be able to select the clip in the Animation window and add events to it by right-clicking in the dark grey section right below the timeline.
Go to the "Rig" tab of the object and select "Generic". It's probably set to Legacy, which won't give you the events option.
Related
I need to combine two animations on the same model, one I got from Internet comes as 30fps. Then I am trying to add a second animation on the same game object and I would like it would be also 30fps, but when creating the animation in the Editor, Unity set it as default to 60fps. I am not able to change that value in the Animator window and in the Inspector the value appears greyed out. I am using Unity 2020.3.29.
Is there any way to change this value in the Editor itself without coding?
Follow these steps:
In the Inspector, open the clip ( 60FPS appears greyed out as you said)
Go to the left menu and select Debug (by default you may have Normal).
Then you will have the option to edit the Sample Rate from 60 to 30, or the value you prefer
Ignacio's answer works. But another way to do that, is to change the whole game FPS using:
Application.TargetFrameRate = 30;
I download the character .fbx file from Mixamo and add to Unity. I want to get .anim file like
.
I try to drag Idle to the Animation window like, but it cannot paste in the Animation window.
I drag Idle to Animator and make a transition like, but when I test by drag character object to Animator and click the play button it not move.
you are not supposed to have 2 idle states. You should be able to make the idle animation in only one state. Like this 1:
Idle State
I think the problem of your animation is not about the format of the file. When you grab all the frames of your animation or just make it in unity, they will turn .anim file.
If you realize that when you play the game the state does not change from entry to Idle. You can try this:
Click on the animation you created, in the inspector and check if is loop is active 2.
Idle Inspector
Add an animator component in your character object3.
Animator
Create an animation controller [4].
[Create Animation Controller][4]
Drag and drop the animator controller in the controller component.
Open the animator and you should be able to drag your Idle animation to the animator tab where you were in. When you run once again your game you should be able to see the animation running.
Note: Some pictures I took are from unity2d, so probably it is not the perfectly the same inspector as yours, but you should be able to find it out. If you do not or if you still have any doubt, you can check this video. He exports it from blender, but the format .fbx is pretty the same. https://www.youtube.com/watch?v=D-oYgs1CP7U&ab_channel=SingleSaplingGames
i want to know what is best way to select 2D object in unity mobile
for example i want to select one object and a menu show up for upgrade
i already searched but didnt find something good
if you write both code and good references would be nice
You can add a Button component to that object and add an OnClick() function call to it :
See a sample in Unity docs
or you can use Touches to have control over different phases :
See a sample in Unity Tutorials
You can add button instead of your GameObject and choose button sprite like as your GameObject's sprite then you will writing function to button to show your menu
I am using Unity 5.1.2p3 with DK2 SDK 0.6.0.1 and I understand from this post that Screen Space - Overlay is not supported in Unity VR. It is recommended to use Screen Space - Camera (which in my case does not work) or World Space (which I am using now) but I need someone to help me understand how I get simple menu with buttons and toggles to show as a still image and how I can make selections and button presses with my mouse cursor.
I have created a menu for my app, with 4 toggles and 1 button. When I check the Virtual Reality Supported option with the Oculus being in Direct Mode and Canvas being in World Space, I can see it in VR, but I cannot see/find my mouse cursor to tick one of the toggles.
When I take off the headset, on my monitor's Game View tab, I can see and even use the mouse and select a toggle. Obviously, I have to keep the headset steady, so in my Game View, things do not shake!
Another thing I notice is that the VR camera is the same as the Main Camera in the Unity Hierarchy, but when I take off the headset and move it around, the position of the camera does not change, only looking up and down and around is reflected.
How do I simply do a static menu like a 2D surface that does not move in VR and a user can use button presses and muse clicks with the headset on? What settings are required for this way of doing UI and canvas stuff? There are 2 attachments, showing my current settings...
Are you specifically wanting to use the mouse? If you look through a blog entry I wrote below, it will show you how to use Gaze looking to trigger menu buttons:
http://talesfromtherift.com/vr-gaze-input/
You can achieve this by some code I list there that raycasts from the center of the screen and if it hits any UI, it will trigger the correct events and make it clickable by button (or by time).
Steps taken:
Imported rigged/animated character (fbx file) from Blender(version 2.66a) into Unity(I believe the version I am using is 4.1.2; I know that I have downloaded/installed it within the last few days)
Checked 'Import Animation' in Animation settings in the Inspector
Created/tested animation clips in the Inspector
Dragged the character from the Asset panel to the Hierarchy panel
After dragging the character to the Hierarchy panel, I notice that I no longer see the animations when I select the character instance that is in the scene. If I run the game I receive the MissingComponentException referenced in the title.
In summary, I can see the animation in the import settings in the Inspector, but once I drag the character into the scene the animations disappear.
Here is my simple code to play the "idle" animation (which is named correctly and playing correctly in the import settings):
void Start () {
animation.Play("Idle");
}
There are two ways in Unity 4 to call a model's animations.
The "classic" way, like in Unity 3:
By importing the fbx you have to set the "animation type" under "Rig" to "legacy."
In the Hierachy the model needs the "Animation" component and NOT the "Animator" component!
Then you have to add the animations from your model to the animation component.
Now you can write
animation.Play("Idle");
The "new" Mechanim way:
By importing the fbx you have to set the "animation type" under "Rig" to "generic."
In the Hierachy the model needs the "Animatior" component and NOT the "Animaton" component!
Then you have to add the animations from your model to the animation controller, which you add to your Animator component.
In the controller you can set values to switch between different animations. But if you want to use Mechanim look at this tutorial, it helped me a lot!
http://www.youtube.com/watch?v=Xx21y9eJq1U
In the Import Setting for the object, go to Rig and set the animation Type to Legacy.