[request] how to access houdini parameters with scripts?

   6004   1   0
User Avatar
Member
40 posts
Joined: Dec. 2014
Offline
Hello!.

im working in some assets that spawn and configure unity prefabs, however, i would like to attach an script on houdini that auto assigns the prefab to the instance inside houdini using Resources.Load(), my question would be

-how can i access exposed parameters of a digital asset with code in unity?, lets say a float or an integrer
-is the same process to assign a game object to an instance node?
-how can i create a digital asset with code? (i want to create a custom editor so i dont have to search all the time in the project folders)

everything is inside unity.

thanks!
User Avatar
Member
402 posts
Joined: March 2013
Offline
1. You can access the parms on an asset using the HoudiniAssetAccessor (defined in Houdini Script Access/HoudiniAssetAccessor.cs). See ExampleScript.cs and ExampleScriptGUI.cs for a simple example on how to use HoudiniAssetAccessor.

2. I'm assuming here you're talking about the “Houdini Instancer Manager (Script)” component parameters - so NOT stuff in the “Houdini Asset OTL (Script)” component. If so, then no, HoudiniAssetAccessor won't work here. The assignments are actually stored on the instancer GameObjects themselves, deep inside the asset hierarchy. I would look at HoudiniInstancerManagerGUI.generateAssetInstanceControls() function for an an idea on how to access the individual instancer data but I wouldn't recommend trying to do this manually because this code can change at any time and break your implementation. Officially, changing what is being instanced via script is not supported currently.

3. Should be fairly easy but again, officially, instantiating assets via script is not supported as the functions involved can change at any time. But if you must see Houdini/HoudiniWindowDebug.cs, particularly the OnGUI() function. It goes through a folder, looks for otls/hdas and adds a button for each that when pressed instantiates that asset.

We're working on more HoudiniAssetAccessor-like “API” script control of Houdini assets in Unity so #2 and #3 will be officially supported at some point but for now, only parameter changes via script is supported.
  • Quick Links