slavniyteo / one-line

One line property drawer for Unity3d
MIT License
146 stars 12 forks source link

One line does not work? #33

Closed kk3hi3123 closed 5 years ago

kk3hi3123 commented 5 years ago

The OneLine examples work as instruction. But when I copy one of the example code to another .cs file and change its name, the new class does not work. Do I miss something like setting or initialize?

slavniyteo commented 5 years ago

Show me what do you do exactly.

OneLine works out of the box and there is no need of any initialization.

kk3hi3123 commented 5 years ago
  1. I start a new project.
  2. Import OneLine.
  3. Add a new C# Script.
  4. Copy from OneLineExample.cs and copy it to my new C# Script.
  5. Remove namespace OneLine.Example, change the class name and menuName.

And here is the result after I create a new asset.

screenshot 2019-01-22 at 9 13 47 am

I am using Unity 2018.2.14f1 and here is the project. TestingProject.zip

slavniyteo commented 5 years ago

Ok, there it is.

Look at the screenshot, at the first property Script lies None (Mono Script), but must be the name of class. This mean that Unity can't properly load your script. image

I've looked through your project. The problem is that you named the file Data.cs, but class inside it is DataAsset. In Unity file must have the same name as public class incide it (this is suitable for classes which inherit from UnityEngine.Object, for example MonoBehaviour's and ScriptableObject's).

So rename file to DataAsset.cs and this is the solution.

I close the issue, but If your problem is not solved completely, feel free to reopen it.


P.S. When you send your project to someone, or if you use version control system (like Git or SVN), all you need to store is:

The rest is temporary files that will be regenerated on the other PC.