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 Jadencandy · Mar 13, 2016 at 08:16 PM · errorunity 2dmovement scriptplatformercompiler

Compiler error

I'm trying to make a simple 2d game and i'm using standard Assets and i have have 4 errors 1) Assets/Standard Assets/2D/Scripts/CrossPlatformInputManager.cs(3,46): error CS0234: The type or namespace name PlatformSpecific' does not exist in the namespace UnityStandardAssets.CrossPlatformInput'. Are you missing an assembly reference?

2) Assets/Standard Assets/2D/Scripts/CrossPlatformInputManager.cs(18,32): error CS0246: The type or namespace name VirtualInput' could not be found. Are you missing a using directive or an assembly reference? 3)Assets/Standard Assets/2D/Scripts/CrossPlatformInputManager.cs(19,32): error CS0246: The type or namespace name VirtualInput' could not be found. Are you missing a using directive or an assembly reference?

4) ssets/Standard Assets/2D/Scripts/CrossPlatformInputManager.cs(3,46): error CS0234: The type or namespace name PlatformSpecific' does not exist in the namespace UnityStandardAssets.CrossPlatformInput'. Are you missing an assembly reference?

here is my code using System; using UnityEngine; using UnityStandardAssets.CrossPlatformInput.PlatformSpecific;

 namespace UnityStandardAssets.CrossPlatformInput
 {
     public static class CrossPlatformInputManager
     {
         public enum ActiveInputMethod
         {
             Hardware,
             Touch
         }
 
 
         private static VirtualInput activeInput;
 
         private static VirtualInput s_TouchInput;
         private static VirtualInput s_HardwareInput;
 
 
         static CrossPlatformInputManager()
         {
             s_TouchInput = new MobileInput();
             s_HardwareInput = new StandaloneInput();
 #if MOBILE_INPUT
             activeInput = s_TouchInput;
 #else
             activeInput = s_HardwareInput;
 #endif
         }
 
         public static void SwitchActiveInputMethod(ActiveInputMethod activeInputMethod)
         {
             switch (activeInputMethod)
             {
                 case ActiveInputMethod.Hardware:
                     activeInput = s_HardwareInput;
                     break;
 
                 case ActiveInputMethod.Touch:
                     activeInput = s_TouchInput;
                     break;
             }
         }
 
         public static bool AxisExists(string name)
         {
             return activeInput.AxisExists(name);
         }
 
         public static bool ButtonExists(string name)
         {
             return activeInput.ButtonExists(name);
         }
 
         public static void RegisterVirtualAxis(VirtualAxis axis)
         {
             activeInput.RegisterVirtualAxis(axis);
         }
 
 
         public static void RegisterVirtualButton(VirtualButton button)
         {
             activeInput.RegisterVirtualButton(button);
         }
 
 
         public static void UnRegisterVirtualAxis(string name)
         {
             if (name == null)
             {
                 throw new ArgumentNullException("name");
             }
             activeInput.UnRegisterVirtualAxis(name);
         }
 
 
         public static void UnRegisterVirtualButton(string name)
         {
             activeInput.UnRegisterVirtualButton(name);
         }
 
 
         // returns a reference to a named virtual axis if it exists otherwise null
         public static VirtualAxis VirtualAxisReference(string name)
         {
             return activeInput.VirtualAxisReference(name);
         }
 
 
         // returns the platform appropriate axis for the given name
         public static float GetAxis(string name)
         {
             return GetAxis(name, false);
         }
 
 
         public static float GetAxisRaw(string name)
         {
             return GetAxis(name, true);
         }
 
 
         // private function handles both types of axis (raw and not raw)
         private static float GetAxis(string name, bool raw)
         {
             return activeInput.GetAxis(name, raw);
         }
 
 
         // -- Button handling --
         public static bool GetButton(string name)
         {
             return activeInput.GetButton(name);
         }
 
 
         public static bool GetButtonDown(string name)
         {
             return activeInput.GetButtonDown(name);
         }
 
 
         public static bool GetButtonUp(string name)
         {
             return activeInput.GetButtonUp(name);
         }
 
 
         public static void SetButtonDown(string name)
         {
             activeInput.SetButtonDown(name);
         }
 
 
         public static void SetButtonUp(string name)
         {
             activeInput.SetButtonUp(name);
         }
 
 
         public static void SetAxisPositive(string name)
         {
             activeInput.SetAxisPositive(name);
         }
 
 
         public static void SetAxisNegative(string name)
         {
             activeInput.SetAxisNegative(name);
         }
 
 
         public static void SetAxisZero(string name)
         {
             activeInput.SetAxisZero(name);
         }
 
 
         public static void SetAxis(string name, float value)
         {
             activeInput.SetAxis(name, value);
         }
 
 
         public static Vector3 mousePosition
         {
             get { return activeInput.MousePosition(); }
         }
 
 
         public static void SetVirtualMousePositionX(float f)
         {
             activeInput.SetVirtualMousePositionX(f);
         }
 
 
         public static void SetVirtualMousePositionY(float f)
         {
             activeInput.SetVirtualMousePositionY(f);
         }
 
 
         public static void SetVirtualMousePositionZ(float f)
         {
             activeInput.SetVirtualMousePositionZ(f);
         }
 
 
         // virtual axis and button classes - applies to mobile input
         // Can be mapped to touch joysticks, tilt, gyro, etc, depending on desired implementation.
         // Could also be implemented by other input devices - kinect, electronic sensors, etc
         public class VirtualAxis
         {
             public string name { get; private set; }
             private float m_Value;
             public bool matchWithInputManager { get; private set; }
 
 
             public VirtualAxis(string name)
                 : this(name, true)
             {
             }
 
 
             public VirtualAxis(string name, bool matchToInputSettings)
             {
                 this.name = name;
                 matchWithInputManager = matchToInputSettings;
             }
 
 
             // removes an axes from the cross platform input system
             public void Remove()
             {
                 UnRegisterVirtualAxis(name);
             }
 
 
             // a controller gameobject (eg. a virtual thumbstick) should update this class
             public void Update(float value)
             {
                 m_Value = value;
             }
 
 
             public float GetValue
             {
                 get { return m_Value; }
             }
 
 
             public float GetValueRaw
             {
                 get { return m_Value; }
             }
         }
 
         // a controller gameobject (eg. a virtual GUI button) should call the
         // 'pressed' function of this class. Other objects can then read the
         // Get/Down/Up state of this button.
         public class VirtualButton
         {
             public string name { get; private set; }
             public bool matchWithInputManager { get; private set; }
 
             private int m_LastPressedFrame = -5;
             private int m_ReleasedFrame = -5;
             private bool m_Pressed;
 
 
             public VirtualButton(string name)
                 : this(name, true)
             {
             }
 
 
             public VirtualButton(string name, bool matchToInputSettings)
             {
                 this.name = name;
                 matchWithInputManager = matchToInputSettings;
             }
 
 
             // A controller gameobject should call this function when the button is pressed down
             public void Pressed()
             {
                 if (m_Pressed)
                 {
                     return;
                 }
                 m_Pressed = true;
                 m_LastPressedFrame = Time.frameCount;
             }
 
 
             // A controller gameobject should call this function when the button is released
             public void Released()
             {
                 m_Pressed = false;
                 m_ReleasedFrame = Time.frameCount;
             }
 
 
             // the controller gameobject should call Remove when the button is destroyed or disabled
             public void Remove()
             {
                 UnRegisterVirtualButton(name);
             }
 
 
             // these are the states of the button which can be read via the cross platform input system
             public bool GetButton
             {
                 get { return m_Pressed; }
             }
 
 
             public bool GetButtonDown
             {
                 get
                 {
                     return m_LastPressedFrame - Time.frameCount == -1;
                 }
             }
 
 
             public bool GetButtonUp
             {
                 get
                 {
                     return (m_ReleasedFrame == Time.frameCount - 1);
                 }
             }
         }
     }
 }
 
Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

54 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

Related Questions

(31,16): error CS1525: Unexpected symbol `(', expecting `)', `,', `;', `[', or `=' 2 Answers

Android Game Save and Load doesn't work 0 Answers

I want to make my player move when i tap key.,How can I make my Player move on tapping key not on holding? 0 Answers

My ground checker only works sometimes 0 Answers

How to make GoalKeeper move within post but not move towards to the player? 1 Answer


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