About 'Move Player Horizontally'!

In this video (objectives)…

  1. Create Player class.
  2. Import CrossPlatformInput.
  3. Move the player's RigidBody horizontally.

After watching (learning outcomes)…

Move the player horizontally using CrossPlatformInput.

(Unique Video Reference: 10_TV_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

1 Like

Why are we using CrossPlatformInputManager.GetAxis exactly? Can’t you just use Input.GetAxis for the same effect, while not having to import a bunch of assets? I must be missing something here.

Yep, you can use other ways. The reason we use the CrossPlatformInputManager is so that we can build the foundations for a game that could be on any platform (ie. mobile, something with a controller, etc). The CrossPlatformInputManager creates a layer between what the player inputs, and what the game does, so that we dont have to write unique code for every type of input device.

Hope this helps.

1 Like

Hello,

are we going to put Rigidbody(Physics) into FixedUpdate later?

Thanks.

Yes, that has been the plan. I was waiting until we hit issues with our game so that we could see some cause and effect, but with our current implementation we haven’t hit any issues.

I certainly have this topic on my radar, thanks for the reminder.

Cool, thanks for the input.
And that’s certainly a good way to learn.

1 Like

Hi all,

I was wondering if there was a relatively easy way (or perhaps this was covered somewhere else in the course, I’ve skipped around a bit) to add buttons for the player’s movement and jumping instead of key presses? The script in the course for player movement is written for key presses. Is it possible to add a MobileUI Canvas with buttons that links to the keys in the Cross Platform Input Manager (i.e., OnButtonDown = right arrow key press)?

Hello, I am having a problem with visual studio in regards to this “move player horizontal” lecture. I have noticed this problem before, but was ignoring it until now.
When you type out a variable type such as ‘int num = 1;’ ‘int’ is in blue lettering signifying that visual studios accepts that as a variable type.
However, with this lecture, typing out Rigidbody2D remains in black lettering–it does not give me a visual studio error–but when I go back to Unity, I get this error message:
Assets/Player.cs(9,5): error CS0246: The type or namespace name ‘Rigidbody2D’ could not be found. Are you missing an assembly reference?
I have basic knowledge with java and c# appears to work similarly, is that error telling me that Rigidbody2D does not exist as a variable type? Do i need to import something?

Unity 2018.1.6f1 Personal
Visual Studio 2017


-Michael

I solved my problem…RigidBody2D vs Rigidbody2D. Capitalized ‘b’ in body. The text remains black, but the error is gone. Hopefully it will work now.

1 Like

Well, I seem to have fallen at the first hurdle on this one. When I click on ‘Assets>Import Packages’ I don’t have the option for Cross Platform Input Manager, in fact I don’t have any options other than Custom Package. It was definitely there when I was doing the Argon Assault project, but now it is not. I must have turned something off somewhere. Can anyone point me in the right direction. Thanks

Open TileVania project, go to asset store, download standard asstets, import it (select only cross platform input elements).

That should work

I think that it will be usefull to sa word or two in this section about [Range()] and [Tooltip()] modificatros.
I write them almost all the time when exposing some variables in editor. It helps futer level desaginers what is what and how to use it :slight_smile:

1 Like

Hi.

What is the name of the standard asset I have to download To be able to import this?

The standard assets are called… Drum roll… "Standard Assets" :slight_smile:

Just check that they are the ones created by Unity Technologies.

Thanks Drum roll … " I am Dumb"

1 Like

hehehe, not at all, the term “standard assets” gets bounded around a lot and if its not capitalised in text then it doesn’t look so obvious that it’s name. I was just playing :slight_smile:

Here’s a link to them;

Note, you may find it easier to download and import them using the Asset Store window within Unity.

Hope this helps :slight_smile:

1 Like

All Set and ready to go ! Thanks Rob

1 Like

Fantastic, and no problem, happy to help :slight_smile:

When Continuing the lecture in player.cs

using UnityStandardAssets.CrossPlatformInput; Doesnt get recognized

And in the unity console I got a warning :

PlayerSettings Validation: Requested build target group (17) doesn’t exist; #define symbols for scripting won’t be added.
UnityEditor.PlayerSettings:SetScriptingDefineSymbolsForGroup(BuildTargetGroup, String)

and

Assets/Standard Assets/Editor/CrossPlatformInput/CrossPlatformInputInitialize.cs(36,34): warning CS0618: UnityEditor.BuildTarget.Tizen' is obsolete:Tizen has been removed in 2017.3’

Might this be Outdated? Or Am i Doing it wrong?

There are two sets of Standard Assets on the Asset Store, one is for version 4.6 of Unity I believe, which did you download?

Privacy & Terms