I have a problem :(

Updated on December 23, 2016 in  [R] Scripts
Share on Facebook0Tweet about this on Twitter0Share on Google+0Share on Reddit0
2 on December 23, 2016

I watched Brackeys video https://www.youtube.com/watch?v=N49cfP-MWJA and when I wrote the same script I had 2 errors! http://prntscr.com/dn162m and http://prntscr.com/dn15q2

  • Liked by
Reply
0 on December 23, 2016

You should take a minute to look at your code for errors before making a thread asking about it. If you download visual studio those errors you mentioned will have a red line under it.

  • Liked by
Reply
Cancel
0 on December 23, 2016

Ok, well I think I know where one of the errors is at least.
 
The video was made with an old version of Uniy, so Unity calls on rigidbodies differently now. Add this to your script to fix issues like this concerning rigidbody:

//global variable (near the top)
var rigidbody : Rigidbody;
 
// add the start function
function Start() {
  rigidbody = GetComponent<Rigidbody>();  // attaches your variable 'rigidbody' to the Rigidbody component of your Player character if there is one
}

 
Now your code might work.

  • Liked by
Reply
Cancel