Quantcast
Channel: Answers by "jaskij"
Viewing all articles
Browse latest Browse all 37

Answer by jaskij

$
0
0
1. Format your code (the button with ones and zeroes). 2. Transform is a class name, not an object of that class - and that is what you need. Consider code below. var speed = 3.0; var crateprefab:Transform; function Update() { if(Input.GetButtonDown("fire1")) { var crate = Instantiate(crateprefab,transform.position,Quaternion.identity); crate.Rigidbody.Addforce(Transform.forward *2000); } } The difference here is that transform (notice the small first letter) is a specific transform, used for the object you attach the script to.

Viewing all articles
Browse latest Browse all 37

Trending Articles



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