Page 1 of 2

Can't import LoveHate into JavaScript code?

Posted: Mon Apr 27, 2015 4:56 pm
by Darryl
I can't seem to import PixelCrushers.LoveHate into a JavaScript file. get;



Namespace 'PixelCrushers.LoveHate' not found, maybe you forgot to add an assembly reference? 



error.



Loads into C# files fine though. I just want to keep to JavaScript though. Any way to remedy this?



Thanks

Can't import LoveHate into JavaScript code?

Posted: Mon Apr 27, 2015 5:55 pm
by Tony Li
Hi,

Put this at the top of your .js file:

Code: Select all

import PixelCrushers.LoveHate;
If you're going to call C# from UnityScript, remember to move the PixelCrushers folder into Plugins so it gets compiled before your UnityScript.

Can't import LoveHate into JavaScript code?

Posted: Mon Apr 27, 2015 6:09 pm
by Darryl
Thanks for the quick reply. Though I did have the import up top, which is what confuddled me. Any other strategies?



Thanks

Can't import LoveHate into JavaScript code?

Posted: Mon Apr 27, 2015 6:19 pm
by Darryl
I dragged to entire PixelCrushers folder into the Plugins folder which got rid of the error. Thanks for the tip!

Can't import LoveHate into JavaScript code?

Posted: Mon Apr 27, 2015 6:23 pm
by Tony Li
Great! If you notice any issues, or have any questions in general about using Love/Hate, don't hesitate to post. I'm finishing up work for the day, but I'll check the forum first thing in the morning.



The new version (1.1) should be available on the Asset Store in a few days, by the way.

Can't import LoveHate into JavaScript code?

Posted: Mon Apr 27, 2015 7:38 pm
by Darryl
I spoke too soon. Dragging the folders around in Unity caused LoveHate to lose links to all kinds of files. Couldn't savage it and had to restore from backup. :(

Can't import LoveHate into JavaScript code?

Posted: Mon Apr 27, 2015 7:52 pm
by Tony Li
Did you drag in Unity's Project view? If you drag outside of Unity (i.e., in your OS), it'll mess up Unity's metadata.

Can't import LoveHate into JavaScript code?

Posted: Mon Apr 27, 2015 8:35 pm
by Darryl
Yes, in the project view. It lost connections to the FactionDatabase and a couple other scripts it said was missing from the editor folder or other places. I tried moving things around to appease it with no luck, just makings things worse. Back to starting point again.

Can't import LoveHate into JavaScript code?

Posted: Tue Apr 28, 2015 3:10 am
by Tony Li
I'll document where to move each folder and post it here. The Love/Hate scripts are all standard Unity C# scripts, doing nothing unusual under the hood. So the process will be the same as for any typical set of C# scripts. I'm at a conference today, so I won't get a chance to post until the end of the day.

Can't import LoveHate into JavaScript code?

Posted: Tue Apr 28, 2015 12:23 pm
by Tony Li
Hi,



Two solutions:







1. If you'll please email your Asset Store invoice number to tony (at) pixelcrushers.com, I'll email you a link to download Love/Hate v1.1. With this version, I created a new Unity 5.0.1f1 project and imported Love/Hate. In the Project view, I created a new folder named "Plugins" and dragged the "Pixel Crushers" folder into it. Everything seems to be fine.







2. Or, to stick with Love/Hate v1.0.2 for now, move "Pixel Crushers" into "Plugins". Then create a folder in Assets named "Editor". Move all the *.cs files from the Editor folders inside Pixel Crushers/LoveHate/Scripts into Assets/Editor. This will be 7 files.