Can't import LoveHate into JavaScript code?

Announcements, support questions, and discussion for Love/Hate.
Darryl
Posts: 6
Joined: Mon Apr 27, 2015 8:49 pm

Can't import LoveHate into JavaScript code?

Post 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
User avatar
Tony Li
Posts: 20731
Joined: Thu Jul 18, 2013 1:27 pm

Can't import LoveHate into JavaScript code?

Post 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.
Last edited by Tony Li on Mon Jun 01, 2015 10:55 am, edited 1 time in total.
Darryl
Posts: 6
Joined: Mon Apr 27, 2015 8:49 pm

Can't import LoveHate into JavaScript code?

Post by Darryl »

Thanks for the quick reply. Though I did have the import up top, which is what confuddled me. Any other strategies?



Thanks
Darryl
Posts: 6
Joined: Mon Apr 27, 2015 8:49 pm

Can't import LoveHate into JavaScript code?

Post by Darryl »

I dragged to entire PixelCrushers folder into the Plugins folder which got rid of the error. Thanks for the tip!
User avatar
Tony Li
Posts: 20731
Joined: Thu Jul 18, 2013 1:27 pm

Can't import LoveHate into JavaScript code?

Post 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.
Darryl
Posts: 6
Joined: Mon Apr 27, 2015 8:49 pm

Can't import LoveHate into JavaScript code?

Post 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. :(
User avatar
Tony Li
Posts: 20731
Joined: Thu Jul 18, 2013 1:27 pm

Can't import LoveHate into JavaScript code?

Post 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.
Darryl
Posts: 6
Joined: Mon Apr 27, 2015 8:49 pm

Can't import LoveHate into JavaScript code?

Post 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.
User avatar
Tony Li
Posts: 20731
Joined: Thu Jul 18, 2013 1:27 pm

Can't import LoveHate into JavaScript code?

Post 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.
User avatar
Tony Li
Posts: 20731
Joined: Thu Jul 18, 2013 1:27 pm

Can't import LoveHate into JavaScript code?

Post 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.


Post Reply