Getting MissingComponentException: There is no animation attached to the game object - unity3d

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.

Related

How to solve "No cameras rendering" in Unity?

I am entirely new to Unity. I have a task to work with a tool in Unity. I'm not sure the "Game" is where I should work or the "Scene"? this is how my "Game" tab looks like, but I saw animations in the "Scene" tab. for changing parameters of animation, I should come back to the "Game" tab to change and again go to the "Scene" tab to see the result. I think something is wrong, and I should see the animation in the "Game" tab. Am I right?
It was confusing for me to explain my problem cause I have no idea!
It's very confusing what is happening in your Unity scene.
I assume either you have a disabled camera object or no camera at all.
Search the hierarchy for a MainCamera object and enable it. The game view is rendered from cameras in the application. If you cannot find a camera gameobject, try adding a camera (Gameobject>Camera). If you could find a camera gameobject, you should also check it's Camera component has target display set to Display 1.
In the Scene View at the top left, you can click 2D View. Then you can select the canvas in the hierarchy and press "F", while your mouse is over the scene view, to focus it there. In the end, you should be able to see the canvas in the scene view just as you can in the game view.
In fact, you don't need a camera in the scene to render UI elements, which is quite confusing. So if you don't need to solve the "no camera rendering" problem, as long as there are no 3D objects you want to draw. Keep in mind that you will probably need to manually place an audio listener if you want to hear something at some point.
In your hierarchy window search box write this :
t:Camera
And see if any will show up. The camera needs to be enabled if there is one present. If there is none, then you need to create one from GameObjects -> Camera.
As above answers indicate, there is a missing Camera object. Please keep in mind also that a disabled parent object will affect child objects. This was my case, my Camera object was a child object for a XR Ring object which was disabled and I was getting the "No Cameras rendering" message.

My animation is not working when I import into Unity

people of stack overflow. I am not sure if this question will be relevant on here since it's not code but I'll try anyway. I want to import a drone animation model into unity. So I used Fusion 360 and saved the animation as an FBX file. When I imported the model, I could put it into my game, but not into my animation editor. So I came here for help. Any advice would help!
The animation
The animation not going into the editor
First it called The animator Tab And you can't edit the animation in that tab because you haven't attached the animation to the object you have. After Dragging the animation into the object you can find the animation in the animator tab automatically.

Collider not animating

I have a roll animation for my character and added the Capsule Collider.Center and Capsule Collider.Height properties to the animation to change the collider's size during the animation.
It won't let me adjust the properties without changing the permanent properties of the collider. I can hit record or select a key and adjust the properties I want, but then all keys for those properties and the properties on the collider on the GameObject are changed to those new values.
To make sure that a collider can be animated, I created a new capsule in the scene, created a new controller for it, then added those same properties to a new animation. That works perfectly, the properties I'm trying to animate work just fine. Why is it not working on my other animation?
Also, I'm using Unity version 2019.4.18f1.
Edit: I can use events to change the collider's size through script, but it would be much smoother if I could animate it with the animator.
I sort of figured out the problem, it's somehow related to how I have my player character made in the Hierarchy. The object with the issue has one level higher of nested objects, that's the one called player. The one that works perfectly and allows me to animate the properties on the Capsule Collider, is the RPG-Character. Every component on the parent objects are identical, RPG-Character has an exact copy of every component on Player, along with their values. I don't get it, but this has fixed my issue.

How to create .anim file from Mixamo to Unity?

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

How do I implement a raycast / laserpointer to Oculus controller?

I want to implement a graphic raycaster/ laserpointer to the left Oculus controller, so I can interact with UI buttons in Unity.
I have seen a lot of tutorials etc. but nothing has helped.
I want a laserbeam or laserpointer/graphic raycast to shoot out from Oculus controller when a button os pressed on the controller. I need the laserbeam to interact with UI buttons in Unity.
You can use a normal raycast
I recomend you make this:
Create a script on your hand,and add a component called line renderer
In the script attach the lineRenderer component
make a simple raycast hit
get the position of the hit object
set the first position of the actual hand and the second to the hit object like this:
lineRenderer.SetPosition(0,transform.position);
lineRenderer.SetPosition(1,hitObject.transform.position);
And it draw a line from your hand to the hit object, remember to change the lineRender parameter to make a beautiful line
hope it helps
I created a project that uses unity's event system. It is a laser pointer which you can interact with unity's UI and 3d objects in the scene. If you want to check it out here's the link: https://github.com/balataca/oculus-laser-pointer