Attaching scripts and tags to instances

   1365   2   1
User Avatar
Member
15 posts
Joined: Sept. 2018
Offline
Hello guys,

I'm working on a Tower Defense game. My need is simple, depending on a curve input, I generate:
- the level mesh: simple static mesh
- the “path mesh”: used to bake the Unity NavMesh automatically attaching a C# script to it
- 1 simple gameobject: (a sphere) used as spawn point (at the start of the curve) automatically attaching a C# script to it as well, and eventually, a Unity tag.



For simplicity, I'd rather have 1 single Geo HDA instance in my Unity scene who generates these 3 things, rather than multiple HDAs linking each other or even a TOP network.

I successfully built the first two things (mesh and navmesh), but using the deprecated “Split by geo” option. Each mesh being in its own group, creating 2 children parented to the HDA instance.



Problems started when I tried to attach a different script to my spawn point (3rd child). The script was never attached.
I digged into the HEU code and figured the problem originated from here [github.com], scriptString always being set to the first scriptAttr element for some reasons, while scriptAttr actually contains 2 (both scripts).

Anyways, I assumed it was because of the “Split by geo” depreciation and tried packed primitives [www.sidefx.com] instead, but I can not get any script attached to the instances (using Copy to Point with “Pack and Instance” checked). Instances just do not ever get any script, while tags do.

Is it possible to attach scripts and tags to packed instances?

Any help or feedback would be greatly appreciated!

Edit: I'm currently using Houdini 18.0.418
Edited by Florian13 - April 24, 2020 06:22:20
User Avatar
Member
1 posts
Joined: June 2019
Offline
I'm unable to apply any attribute to a unity_instance. Is there any way to do this? I just want my instances to be static. Any help on this would be appreciated.
User Avatar
Staff
100 posts
Joined: Dec. 2020
Offline
Hi, we have a specific attribute for this. You can set i@unity_static = 1 to set the instance to static or not-static. You can also rely on the prefab's static flag by setting i@unity_use_instance_flags = 1. For other attributes, see https://www.sidefx.com/docs/unity/_attributes.html [www.sidefx.com]
  • Quick Links