How do I Start/Stop an animation in Unity 5.3 (C#) - c#

So I'm trying to start and stop my walk animation, in unity 5.3.
Something like this.
If(Input.GetKey(KeyCode.RightArrow)){
GetComponent<Animator>().Play("WalkAnimation");
}
else If(!Input.GetKey(KeyCode.RightArrow)){
GetComponent<Animator>().Stop("WalkAnimation");
}
But somehow this doesn't really work out for my.
thanks in advance for your help.

While this doesn't directly answer your question, using direct commands to animation is a legacy functionality, nowadays we use Mekanim animation state machine:
You can find a video tutorial here

Related

There is a way to record my game on unity?

I have a game that I create and I want to add an option to record the game after I build it.
I find the unity recorder but I can use it only at the editor and I want to create a video that the unity save and then the player can watch it at the future.
someone know a solution for that? it seems that anyone don't try it before(or don't publish about it before).
Try using some plug-ins! There are plenty of plug-ins to help you do just that!
As an example, I'm using AVPro to record video in my own project!

Automatic animation after previous in Unity- how to do something like that?

Automatic animation after the previous one in Unity - how to do something like that?
I mean, in my game, I performed the jump function and it has its animations, and how do you do that when it ends, the falling animation will start - that is, right after the jump animation,
Question: How can I start the animation immediately after two in Unity?
Please help!
Thanks to Unity's built in animator this is actually really easy to do without any code. All you have to do is setup a transition to the next animation after that animation plays. I'd recommend this tutorial to get started. (I've already set it to start at the part of the video where he actually talks about it)

Unity android Native Camera as WebcamTexture

Can someone help me about to use the Native Camera of Android in Unity the same way we use WebcamTexture? I want the "camera preview image" in Unity as a texture2d or texture.
Thanks in advance.
I did it once using https://bitbucket.org/Unity-Technologies/graphicsdemos as starting point. You are going to be interested in the RenderingPlugin.cpp.
Back in the day I had to use code in Java as bridge to Android NDK since it was not possible to plug an ImageReader in the camera feed on the C level due to security reasons.
It looks like things got updated and it might be possible to simplify the architecture by using https://github.com/googlesamples/android-ndk/tree/master/camera.
Hope this helps.
ps-> In case you want to do a code walkthrough I put together an end-to-end demo here https://github.com/robsondepaula/unity-android-native-camera

Unity3D Kudan SDK Markerless Augmented Reality Help Guidance

hey all
I am developing a furniture design augmented reality app for my dissertation and need quite a bit of help as I can't find it else where with tutorials etc.
I am doing this in Unity using the Kudan SDK AS it is pretty much the only available sdk that has SLAM technology (markerless) whereas the rest don't and others charge £2000+
I need help with implementing functions for Positioning/moving objects placed in the real world through my iPhone
I need help with implementing functions for adjusting/resizing objects through my iPhone using my fingers on the touch screen
Anyone have a tutorial/script/guidance they can help me with this?
Looking at a drop down box button that when clicked will open the drop down and each drop down item is assigned to an object. Thanks in advance.
you can use a plugin for Unity its called Lean Touch and its Free. It has exactly what you want to achieve with 0% coding.

Kinect 2 skinning a model

I am looking at using the Kinect version 2 for PC to control an avatar, i.e. apply a skin to the body basics example provided by Microsoft.
The avatar isn't to be used in a game or anything at this point. I simply plan to be able to control the avatar using the Kinect 2 and record to .avi. I have already implemented a demo where I can record the Kinect footage of the skeleton directly to .avi.
After searching I found that it was possible to control an avatar with the original Kinect using XNA game studio. As XNA game studio seems a bit out dated now and I'm unsure if it would be compatible with version 2, would there be an alternative approach? Does anybody know of a project where someone has done this already? Or can anyone suggest a good approach to take to do this?
I have also seen some articles referring to a plugin that lets you use Unity with Kinect 2 but from what I can see I don't believe this is publicly available?
Many thanks for any help.
Yes, the unity plug in works great and its the best out there. the creator its call rumen, he will help you if you need it help but ofcourse you have to pay the plugin 1st. its worth it, it makes kinect way simpler.

Categories