Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Tried to set animation speed: Type 'UnityEngine.Component' does not support slicing.

$
0
0
When I try to set an animation speed I get this error: Type 'UnityEngine.Component' does not support slicing. This is the code I have: var WalkSpeedModifier : float = 8; var WalkAnim : String = "Walk"; private var DefaultPos : Vector3; private var Controller : CharacterController; var PlayWhileAiming = false; function Start () { DefaultPos = transform.localPosition; Controller = GameObject.FindGameObjectsWithTag("Player").GetComponent(CharacterController); } function Update () { if (Input.GetAxis("Vertical")||Input.GetAxis("Horizontal")) { gameObject.animation.CrossFade(WalkAnim, 0.4); animation[WalkAnim].speed = Controller.velocity.magnitude / WalkSpeedModifier; } else { transform.localPosition = Vector3.Lerp(transform.localPosition, DefaultPos, 5); WalkAnim.GetComponent.().Stop; } if (Input.GetButton("Fire2") && PlayWhileAiming == false) { transform.localPosition = Vector3.Lerp(transform.localPosition, DefaultPos, 5); WalkAnim.GetComponent.().Stop; } }

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>