Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by sisment · Mar 16, 2014 at 06:45 AM · movementtutorialmissingspace shooter

The referenced script on this behavior is missing!

I've just began using unity, and I am doing the Space Shooter Project, I'm on Video 6 (moving the player), and I'm stuck. I'm programming movement for the Spaceship, and one of the scripts is missing. Here is a link of my screen. Any help is appreciated. I've tried copying code directly fromt he tutorial video's description, but it doesn't work.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sisment · Mar 16, 2014 at 05:47 PM 0
Share

I removed the missing script, and copied the done_player controller code into player controller, but it still does not work. I also found a page on the missing script, but I don't understand it. I also have code for done_player controller, it has something in it about $$anonymous$$onoBehavior.

 using UnityEngine;
 using System.Collections;
 
 [System.Serializable]
 public class Done_Boundary 
 {
     public float x$$anonymous$$in, x$$anonymous$$ax, z$$anonymous$$in, z$$anonymous$$ax;
 }
 
 public class Done_PlayerController : $$anonymous$$onoBehaviour
 {
     public float speed;
     public float tilt;
     public Done_Boundary boundary;
     
     public GameObject shot;
     public Transform shotSpawn;
     public float fireRate;
     
     private float nextFire;
     
     void Update ()
     {
         if (Input.GetButton("Fire1") && Time.time > nextFire) 
         {
             nextFire = Time.time + fireRate;
             Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
             audio.Play ();
         }
     }
     
     void FixedUpdate ()
     {
         float moveHorizontal = Input.GetAxis ("Horizontal");
         float moveVertical = Input.GetAxis ("Vertical");
         
         Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
         rigidbody.velocity = movement * speed;
         
         rigidbody.position = new Vector3
             (
                 $$anonymous$$athf.Clamp (rigidbody.position.x, boundary.x$$anonymous$$in, boundary.x$$anonymous$$ax), 
                 0.0f, 
                 $$anonymous$$athf.Clamp (rigidbody.position.z, boundary.z$$anonymous$$in, boundary.z$$anonymous$$ax)
                 );
         
         rigidbody.rotation = Quaternion.Euler (0.0f, 0.0f, rigidbody.velocity.x * -tilt);
     }
 }
 

 

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by jbecana · Mar 16, 2014 at 10:49 AM

I think player only needs one player controller script, and you have two, I guess the missing one, done_player controller is the one done by the instructor. Have you tried just to remove the missing script component or replace the player controller by the done player controller?

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jbecana · Mar 16, 2014 at 06:30 PM 0
Share

Looks like you have the same classes in two different scripts. $$anonymous$$ove out of the assets directory the one is not attached to anything. $$anonymous$$onobehaviour is a the base class for your script. Your script needs to extend $$anonymous$$onobehaviour so you can use the Start(), Update() methods... Take care when you change the name of the scripts files because objects that have them attached as components loose their connection.

avatar image
0

Answer by sisment · Mar 16, 2014 at 07:16 PM

Thank you! It worked.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Car movement script ? 1 Answer

Issues with C# script (using tutorial) 1 Answer

Movement doesnt work if I rotate my model 2 Answers

Smooth Camera Follow Script, Weird Movement... Please help! 1 Answer

Burg Zerg Arcade Tutorial Help 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges