Hi, i only can make easy animation in Unity, but how to make animation that start when i touch cube? For example i have 2 cubes. First cube is static and when i touch first cube, second cube will be animated. Second cube animation is disabled and not working when start level. How to make script in c#? I tried, but animation is playing when i start level- i dont want this.
1 Answer
1I’m a noob so sorry if I’m wrong, just trying to help.
Try this, Open the Animation tap and create two clips. Call one Idle and the other Animation1 (or whatever you want) (See Image A)
in the Idle clip just put one image on the time line. This will create a motionless animation. On the other clip put your animation in the time line. Now Open the Animator tap. Find the Idle Square and right click it. In the drop down select “Set as layer default state” Right click it again and click “Make Transition” Drag the arrow to the Animation1 square. Do the same to animation1 and drag the arrow back to idle. Find the Parameters tab in the Animator(See “image B”). Click the plus to add an new bool and call it “playAnimation1” or whatever makes sense to you. Now click on the arrow pointing to Animation1 and in the Inspector find Conditions.(See Image C) Add one if needed. The left box is the variable type and the right is the value. Set it to playAnimation1 = true. Do the same for the arrow pointing back to idle. Change conditions to playAnimation1 = false. Now to change the animations in code.
Store the animator like this
private Animator myAnimator;
then to change the animation clip like this.
MyAnimator.SetBool (“playAnimaiton1”,true);

hi no just simple words like password etc just like a password on a computer it asks for password but this is a little different since there will be a list of 60000 + words and more than 1 password at times. but again just simple words no "coding words or codes " just simple list of thousands of words
– sid4and can I ask you , if I use this dictionary, would it take very long to grab the check ? about how long would the grab attempt take 10 seconds 5 seconds or ? or is 60k words not much for the compiler?
– sid4Probably a HashSet instead of a Dictionary actually, since the word itself would be the key as well :) @sid4 it will take a few milliseconds probably. When using a hash-based collection, the size of the collection doesn't affect the fetch time because there's no need to search through elements in the collection. It's almoat like fetching from an array with index number, only slightly slower since the process of figuring out the hash takes some time etc.
– NoseKills