Inconsistent line endings

Hello There.
My ship appears to have a weird bug where all buttons stop working and the following message appears in the console window.

Here’s the kicker, the problem only happens when the console window is open. The problem may be related to the script for printing in the console window so here it is now, though I typed everything present in the lesson. Thanks for the help!

Hi Connor,

Your screenshot displays a warning not an error, as such this isn’t going to stop your code from executing, however, it may prevent a your code from compiling and as such recent changes may not get included when you run your game.

The specific warning is caused by the special characters used for line endings, if you are using a Mac, for example, but you copy/paste some code into your script which has been provided by someone using Windows, you’ll have different line ending characters.

The easiest way to resolve this is;

  • within Visual Studio goto the File / Save As… option
  • click on the down arrow next to the Save button
    image
  • select Save with Encoding and confirm the prompt
  • click on the drop down menu for Line Endings
  • image
  • select the appropriate option for your operating system
  • click Ok to confirm the changes

Regarding your problem, it’s not possible to diagnose from that code example you have provided, which in itself, doesn’t seem to relate to player input.

Please note, it’s better to copy/paste your code and apply the code fencing characters, rather than using screenshots. Screenshots are ideal for displaying specific details from within a game engine editor or even error messages, but for code, they tend to be less readable, especially on mobile devices which can require extensive zooming and scrolling.

You also prevent those that may offer to help you the ability to copy/paste part of your code back to you with suggestions and/or corrections, meaning that they would need to type a potentially lengthy response. You will often find that people are more likely to respond to your questions if you make it as easy as possible for them to do so.

Hope this helps :slight_smile:


See also;

Thank you very much for the help. This seems to have cleared up the warning. As far as the code stopping, you were right. The game only freezes when you switch from project to console mode or vice versa while the game is playing…not a problem, but an interesting property. Thank you again for the help!

1 Like

You’re very welcome Connor :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms