Unity import script

Anything you want to share!
ajon1993
Posts: 4
Joined: Tue Jul 27, 2010 9:48 pm

Re: Unity import script

Post by ajon1993 » Tue Jul 27, 2010 10:50 pm

Where is the assets folder at? Do you mean Standard Assets?

I know its probably a dumb question, its just that i tried creating an assets folder and then an Editor folder inside it but that didnt work. and i dont see any default Assets folder in my project besides Standard Assets.

User avatar
AdamB
Site Admin
Posts: 2294
Joined: Wed Apr 16, 2008 10:11 am
Location: Brighton, UK
Contact:

Re: Unity import script

Post by AdamB » Wed Jul 28, 2010 6:08 am

ajon1993 wrote:Where is the assets folder at? Do you mean Standard Assets?
No. Unity projects have a folder layout like this:

MyProject
....Assets
........Editor
............LightUp.js
........Standard Assets
............Fonts
............Particles
............etc
........Some_other_asset_you_imported
....Library
........AssetVersioning.db
........etc
Developer of LightUp http://www.light-up.co.uk

yann
Posts: 25
Joined: Sun Oct 12, 2008 1:59 pm

Re: Unity import script

Post by yann » Mon Sep 27, 2010 9:23 pm

@Adam : in Unity 3, the script returns an error on following line :

Code: Select all

preview = AssetDatabase.LoadAssetAtPath(assetPath.Substring(0, assetPath.LastIndexOf(".")) + "_thumbnail.tif", Texture2D);
Appearently, removing "preview =" from the beginning of the line solves the problem :

Code: Select all

AssetDatabase.LoadAssetAtPath(assetPath.Substring(0, assetPath.LastIndexOf(".")) + "_thumbnail.tif", Texture2D);

User avatar
AdamB
Site Admin
Posts: 2294
Joined: Wed Apr 16, 2008 10:11 am
Location: Brighton, UK
Contact:

Re: Unity import script

Post by AdamB » Tue Sep 28, 2010 12:57 pm

Thanks Yann. Yes, its actually not a Unity 3 thing really. It was just not setting the Unity Thumbnail image correctly and I guess Unity 3 is more picky.

So I've updated the LightUp.js script attached to this thread here so you'll now get the small 64x64 thumbnail image LightUp automagically creates on export showing in the Unity Inspector.
Developer of LightUp http://www.light-up.co.uk

Pixero
Posts: 99
Joined: Thu Nov 19, 2009 8:18 am

Re: Unity import script

Post by Pixero » Sat Mar 05, 2011 7:02 am

I get this error message in Unity when importing a model I'm working on.
Using latest LU (2.0b) latest import script and latest Unity (3.3).
InvalidCastException: Cannot cast from source type to destination type.
LightUpMeshPostprocessor.OnAssignMaterialModel (UnityEngine.Material material, UnityEngine.Renderer renderer) (at Assets/Editor/LightUp.js:62)
That line in the import script is:

Code: Select all

var  tex:Texture2D = material.GetTexture("_MainTex");

User avatar
AdamB
Site Admin
Posts: 2294
Joined: Wed Apr 16, 2008 10:11 am
Location: Brighton, UK
Contact:

Re: Unity import script

Post by AdamB » Sat Mar 05, 2011 3:21 pm

[Just spent the week here at the Game Developer Conference chatting with the splendid Unity guys.]

Looks a reasonable line, but I'll chase them up for their thoughts as to what they changed for the new version.

Adam
Developer of LightUp http://www.light-up.co.uk

Pixero
Posts: 99
Joined: Thu Nov 19, 2009 8:18 am

Re: Unity import script

Post by Pixero » Sun Mar 06, 2011 8:28 pm

Would it be possible to edit the script to make it work with the Unity standard diffuse shader the way the built in lightmapper Beast does?
Why? I want to mix LU lightmapped (AO only) and realtime sunlight for animated shadows from trees.

dendrophile
Posts: 1
Joined: Mon Mar 07, 2011 3:12 pm

Re: Unity import script

Post by dendrophile » Mon Mar 07, 2011 3:25 pm

@Pixero

Those splendid Unity guys are here to help. I have just grabbed:

SketchUp: v7.1
LightUp: v2.0
Unity: c3.3.0f4

and am running on a Mac. I can successfully import the example0.skp file into Unity using the 10th Jan version of Adam's LightUp.js. The error on line 62 is a little puzzling. GetTexture returns a Texture, and the Texture2D type is derived from it, so there is nothing "wrong" about this line. I've tried Unity 3.2.0f3 and get things to work, so I don't think there is much that has changed in 3.3 that would cause this to break. Can I trouble you to try to get example0.skp into an empty Unity project? If you get a problem with this simple case, let me know and perhaps send over the project to us support at unity3d dot com. Mention Graham/Dendrophile.

Sorry I cannot give you an instant fix. Actually, I guess the model you are working on is more complicated that the simple example one. Are you able to send me over that artwork?

Thanks,
Graham

Pixero
Posts: 99
Joined: Thu Nov 19, 2009 8:18 am

Re: Unity import script

Post by Pixero » Tue Mar 08, 2011 6:11 pm

The problem seem to be for this perticular scene so I'll keep investigating...

Pixero
Posts: 99
Joined: Thu Nov 19, 2009 8:18 am

Re: Unity import script

Post by Pixero » Tue Mar 08, 2011 8:24 pm

A few objects in the scene weren't imported into Unity so I tried exploding those parts of the scene and that made it work. Textures applied and all.
Must have been some error upon import when the problem grouped geometry was not beeing found?
All is well, but I still would like it to work with Unity's standard shaders like Beast do.

Post Reply