Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by molooco · Mar 30, 2016 at 11:18 PM · support

2 Errores - Help

I have this two errors can someone help me? - theres no script in the game - its a new project - with all projects i create happends the same - i alredy reinstalled unity

Assets/_CompletedAssets/Scripts/Player/PlayerMovement.cs(2,7): error CS0246: The type or namespace name CrossPlatformInput' could not be found. Are you missing a using directive or an assembly reference? using UnityEngine; using UnitySampleAssets.CrossPlatformInput; namespace CompleteProject { %|-433672157_1|% %|2078677662_2|% %|-960817400_3|% Vector3 movement; // The vector to store the direction of the player's movement. %|954322225_5|% %|139389586_6|% #if !MOBILE_INPUT %|108820483_7|% float camRayLength = 100f; // The length of the ray from the camera into the scene. #endif %|-833312685_3|% { #if !MOBILE_INPUT %|-2086315563_11|% %|-34666910_12|% #endif %|1015702605_13|% %|-778227902_14|% %|695110094_15|% %|705329995_5|% %|-1273674829_6|% %|-1381978598_7|% // Store the input axes. %|1664116609_20|% %|297344581_9|% %|477576963_22|% %|-1357247992_10|% %|2146842196_24|% %|-2143670267_5|% %|-1355795641_26|% %|-66852631_27|% %|1289392148_28|% %|705546561_29|% %|-961837370_12|% %|-1239089460_13|% %|-1277423159_32|% %|524414672_33|% %|1742129494_34|% %|-2021127989_35|% // Move the player to it's current position plus the movement. %|-1948093882_37|% %|180843283_15|% %|-2062653608_6|% %|-1423877385_40|% #if !MOBILE_INPUT %|1446350258_41|% %|-2023683103_42|% %|2071959344_43|% %|1622528017_44|% %|-2078832705_17|% if(Physics.Raycast (camRay, out floorHit, camRayLength, floorMask)) %|1083553053_47|% %|-1656574094_9|% %|903857222_49|% // Ensure the vector is entirely along the floor plane. %|1827352951_51|% %|753774082_21|% Quaternion newRotatation = Quaternion.LookRotation (playerToMouse); %|-1004717006_12|% %|-510000701_55|% %|-378024163_56|% #else %|-567826961_57|% %|1904809536_13|% %|365929813_59|% %|-928613029_12|% %|-1734112018_26|% %|552738566_27|% %|-1705560092_28|% %|769338795_64|% %|-8252477_65|% %|-2011431768_66|% %|1794584841_29|% %|1838234659_68|% #endif %|-1746828228_30|% %|451969736_70|% %|-1733310505_71|% %|627526176_72|% %|-2039333107_73|% %|2114265875_74|% anim.SetBool ("IsWalking", walking); %|229936590_76|% %|1049150749_77|% } Assets/_CompletedAssets/Scripts/Player/PlayerShooting.cs(2,7): error CS0246: The type or namespace name UnitySampleAssets' could not be found. Are you missing a using directive or an assembly reference?

 using UnityEngine;
 using UnitySampleAssets.CrossPlatformInput;
 
 namespace CompleteProject
 {
     public class PlayerShooting : MonoBehaviour
     {
         public int damagePerShot = 20;                  // The damage inflicted by each bullet.
         public float timeBetweenBullets = 0.15f;        // The time between each shot.
         public float range = 100f;                      // The distance the gun can fire.
 
 
         float timer;                                    // A timer to determine when to fire.
         Ray shootRay;                                   // A ray from the gun end forwards.
         RaycastHit shootHit;                            // A raycast hit to get information about what was hit.
         int shootableMask;                              // A layer mask so the raycast only hits things on the shootable layer.
         ParticleSystem gunParticles;                    // Reference to the particle system.
         LineRenderer gunLine;                           // Reference to the line renderer.
         AudioSource gunAudio;                           // Reference to the audio source.
         Light gunLight;                                 // Reference to the light component.
         float effectsDisplayTime = 0.2f;                // The proportion of the timeBetweenBullets that the effects will display for.
 
 
         void Awake ()
         {
             // Create a layer mask for the Shootable layer.
             shootableMask = LayerMask.GetMask ("Shootable");
 
             // Set up the references.
             gunParticles = GetComponent<ParticleSystem> ();
             gunLine = GetComponent <LineRenderer> ();
             gunAudio = GetComponent<AudioSource> ();
             gunLight = GetComponent<Light> ();
         }
 
 
         void Update ()
         {
             // Add the time since Update was last called to the timer.
             timer += Time.deltaTime;
 
 #if !MOBILE_INPUT
             // If the Fire1 button is being press and it's time to fire...
             if(Input.GetButton ("Fire1") && timer >= timeBetweenBullets && Time.timeScale != 0)
             {
                 // ... shoot the gun.
                 Shoot ();
             }
 #else
             // If there is input on the shoot direction stick and it's time to fire...
             if ((CrossPlatformInputManager.GetAxisRaw("Mouse X") != 0 || CrossPlatformInputManager.GetAxisRaw("Mouse Y") != 0) && timer >= timeBetweenBullets)
             {
                 // ... shoot the gun
                 Shoot();
             }
 #endif
             // If the timer has exceeded the proportion of timeBetweenBullets that the effects should be displayed for...
             if(timer >= timeBetweenBullets * effectsDisplayTime)
             {
                 // ... disable the effects.
                 DisableEffects ();
             }
         }
 
 
         public void DisableEffects ()
         {
             // Disable the line renderer and the light.
             gunLine.enabled = false;
             gunLight.enabled = false;
         }
 
 
         void Shoot ()
         {
             // Reset the timer.
             timer = 0f;
 
             // Play the gun shot audioclip.
             gunAudio.Play ();
 
             // Enable the light.
             gunLight.enabled = true;
 
             // Stop the particles from playing if they were, then start the particles.
             gunParticles.Stop ();
             gunParticles.Play ();
 
             // Enable the line renderer and set it's first position to be the end of the gun.
             gunLine.enabled = true;
             gunLine.SetPosition (0, transform.position);
 
             // Set the shootRay so that it starts at the end of the gun and points forward from the barrel.
             shootRay.origin = transform.position;
             shootRay.direction = transform.forward;
 
             // Perform the raycast against gameobjects on the shootable layer and if it hits something...
             if(Physics.Raycast (shootRay, out shootHit, range, shootableMask))
             {
                 // Try and find an EnemyHealth script on the gameobject hit.
                 EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth> ();
 
                 // If the EnemyHealth component exist...
                 if(enemyHealth != null)
                 {
                     // ... the enemy should take damage.
                     enemyHealth.TakeDamage (damagePerShot, shootHit.point);
                 }
 
                 // Set the second position of the line renderer to the point the raycast hit.
                 gunLine.SetPosition (1, shootHit.point);
             }
             // If the raycast didn't hit anything on the shootable layer...
             else
             {
                 // ... set the second position of the line renderer to the fullest extent of the gun's range.
                 gunLine.SetPosition (1, shootRay.origin + shootRay.direction * range);
             }
         }
     }
 }












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 jgodfrey · Apr 15, 2016 at 09:46 PM 0
Share

I'm confused. You say there are no scripts in the project, but then you post a script that's obviously causing the error (because the assembly containing UnitySampleAssets can't be found). Can you clarify?

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Blue-Cut · Apr 16, 2016 at 11:15 AM

Did you actually import "CrossPlatformInput" in your project ?

It 's not enough to just write "using UnitySampleAssets.CrossPlatformInput;", you need to have this in your project. Check "StandardAssets".

Assets => Import Package => CrossPlatformInput

 using UnityStandardAssets.CrossPlatformInput;

I am not sure why you are dealing with UnitySamplesAssets or something but I guess the StandardAssets are what you are looking for.

Comment
Add comment · Show 2 · 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 molooco · Apr 17, 2016 at 12:35 AM 0
Share

When i started the project at once i had millions of errors then inported CrossPlatformInput andiit just left me that 2 errors

avatar image Blue-Cut · Apr 17, 2016 at 08:42 AM 0
Share

But why do you have using UnitySampleAssets? If you did the importation, you probably imported CrossPlatformInputfrom StandardAssets. Did you try to replace the using line by the one in my Answer.

The using line is here to find another namespace in your project. If you want to use the CrossPlatformInputin the StandardAssets, you need to use the namespace of StandardAssets scripts :

 using UnityStandardAssets.CrossPlatformInput;

avatar image
0

Answer by molooco · May 30, 2016 at 10:12 PM

Thank you

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

55 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Issue with the OBB Downloader plugin 0 Answers

Cannot set VR devices because the platform passed isn't supported by Unity. 0 Answers

Cannot choose the windows target build 0 Answers

Tornado picks up players but not animals 1 Answer

Why doesn't my camera component spawn at the object? 2 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