A place to discuss everything related to Newton Dynamics.
Moderators: Sascha Willems, walaber
by blackbird_dream » Tue Dec 05, 2017 11:12 am
Hi all,
I've built a class as a subclass of NewtonBodyScript to design an object with physics capabilities. In particular I can implement the inherited event OnApplyForceAndTorque.
As I also designed popuplists and toggles in order to set the parameters of my object in designmode I used a subclass of Editor.
Let's say
- Code: Select all
public class toto:NewtonBodyScript
{etc
override public void OnApplyForceAndTorque(float timestep)
{etc}
}
[CustomEditor(typeof(toto))]
public class totoEditor : Editor
{etc }
It runs well in design mode but I can't build the exe (because of the Editor class). I read somewehre that I must move the script in the subdirectory named Editor. But now the error msg is
"the class named 'toto' is not derived from MonoBehaviour or ScriptableObject!"
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
by Sweenie » Tue Dec 05, 2017 12:55 pm
If your class/plugin code resides directly inside your project(not precompiled) you can use the #if UNITY_EDITOR directive to make unity strip out the editor parts when building/publishing the project.
However if your code is precompiled, like our Newtonplugin is, this directive wont work and you have to put the editor stuff in a separate dll. Like we did with NewtonEditorPlugin.
-
Sweenie
-
- Posts: 498
- Joined: Mon Jan 24, 2005 7:59 am
- Location: Sweden
by blackbird_dream » Wed Dec 06, 2017 4:48 am
oh yes it works fine by splitting the 2 parts and moving the Editor part to the folder /Editor.
Thks
-
blackbird_dream
-
- Posts: 354
- Joined: Wed Jun 07, 2006 3:08 pm
- Location: France
Return to General Discussion
Who is online
Users browsing this forum: No registered users and 10 guests