c# - Convert Code from Unity 4 To Unity 5 -


i new installed unity 5. have problem in code.

if (transform.parent.rigidbody) parentmagnitude = transform.parent.rigidbody.velocity.magnitude * 0.05f;

you can't access rigidbody old shorthand code.

    rigidbody rb = transform.parent.getcomponent<rigidbody>();     if(rb != null) {         parentmagnitude = rb.velocity.magnitude * 0.05f;     } 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -