Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChristopher Westman
9,680 PointsI'm re-checking my work and the fly still isn't being destroyed.
I've been using Visual Studio because that is what Unity launched when I double clicked the script. Below the script is the error that is being thrown in Unity whenever I go to play it.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class FlyPickup : MonoBehaviour {
void OnTriggerEnter(Collider other)
{
// If the collider 'other' ('other' meaning an object 'other than' itself) has a tag "Player"...
if (other.CompareTag("Player"))
{
Destroy(gameObject);
}
}
}
Error thrown: There are inconsistent line endings in the 'Assets/Scripts/FlyPickup.cs' script. Some are Mac OS X (UNIX) and some are Windows. This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.
1 Answer
Jonas Gamburg
11,193 PointsThe solution to your problem depends on what external script editor you are using. The error is caused by as it says, line-endings. Its not a coding error in the sense that you typed something wrong so that should be a relief.
Somewhere in your script editor, there should be a drop down for line endings. Find the platform you're currently working on and choose that one. That should fix it.
P.S I am also using Visual Studio and so far I had no problems. So it might be a settings related issue, rather than code.
Source: http://answers.unity3d.com/questions/165932/what-would-cause-this-error.html