Jump to content

Unity 5 shader AssetBundle bootstrap (?)


Recommended Posts

I've got a few shaders in my RasterPropMonitor mod that I embedded in the DLL and I load using the obsolete way of feeding the text to a new Material object.  That generates warnings with KSP 1.1 when compiling, so I really need to find something that can bootstrap me into the Unity 5 approved way of generating a shader AssetBundle.  I tried pasting an existing text into a new shader asset in Unity 5 today, and I got all sorts of errors starting, so it's not going to be a seamless transition.  My shaders are fairly simple, but I'm not familiar with the Unity 4 / Unity 5 environment, so I've been mostly getting by with lucky guesses.

Does anyone point me at a resource that can tell me how to create a new asset that contains a shader, get the shader to compile successfully (it did with the Cg stuff included with Unity 4), and export that into an AssetBundle?

 

Link to comment
Share on other sites

And if you don't know how to put something in a bundle. Select your shader, look in the lower right pane and you will be able to select a bundle/create one. Then you ll need the new PartTool to generate the bundle.

Pic of the menu :

2016-01-20%2B%25282%2529.png

 

 

Link to comment
Share on other sites

I must be dense.  There is a step I'm still missing.  I've got KSP PartTool 1.1 installed, I've created the shader, and I got it to compile (don't know why it didn't previously).  I've created an asset bundle as you described.  I found KSPAssets/AssetCompiler.  Here's what I see when I open it:

cGy2xy.jpg

 

I've already tried to update/build.  If I click View, I see this:

b2K3Om.jpg

Nothing is checked under Auto.  I don't know if that matters.  If I press 'Select', nothing appears to happen.  If I press Show All to go back up, and I press Update and Build, what I end up with is an empty Assets directory and a mostly-empty XML.

wcx9EL.jpg

 

It seems I am missing a step that tells the tool to add the shader to the bundle, or at least attaches the output of the compiled shader to the bundle.

 

Link to comment
Share on other sites

I could not get the auto load to work in the Pre (but I did not look all that much). I ll have an other look and and test with only a shader

 

Edited by sarbian
Link to comment
Share on other sites

  • 2 weeks later...

I kept poking around with this, and it appears that PartTools didn't like the asset bundle name matching the scene name (?!?)

Quote

Cannot mark assets and scenes in one AssetBundle. AssetBundle name is "rpm-fontshader".

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...