Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Set Volume to the Volume Controller at Runtime
#1
I have a "Kart" with the Volume Controller. I want to use it in different scenes, in which I have created Tracks using CG. There's just one track per scene and the tracks don't change at runtime.

As I understand it, even though I have generated a stand-alone mesh for each Track, I'll still need to have the Curvy Generator hierarchy game objects active, but without the "Create Mesh" module, as the mesh has already been created. This way, I can find a reference to the created volume for the Track in individual scenes.

So, to set the Volume in the Volume Controller, I'll search using a tag for the game object having either the BuildShapeExtrusion or the BuildShape component. However, I haven't succeeded in getting a reference to the Volume by having a reference to these components. Obviously, I'm not doing it the right way.

I'd really appreciate it if you could tell me how to achieve this, so I can set the Volume to the Volume Controller after each scene is loaded.

Thank you!
Reply
#2
(04-08-2024, 10:17 AM)pako88 Wrote: I have a "Kart" with the Volume Controller. I want to use it in different scenes, in which I have created Tracks using CG. There's just one track per scene and the tracks don't change at runtime.

As I understand it, even though I have generated a stand-alone mesh for each Track, I'll still need to have the Curvy Generator hierarchy game objects active, but without the "Create Mesh" module, as the mesh has already been created. This way, I can find a reference to the created volume for the Track in individual scenes.

So, to set the Volume in the Volume Controller, I'll search using a tag for the game object having either the BuildShapeExtrusion or the BuildShape component. However, I haven't succeeded in getting a reference to the Volume by having a reference to these components. Obviously, I'm not doing it the right way.

I'd really appreciate it if you could tell me how to achieve this, so I can set the Volume to the Volume Controller after each scene is loaded.

Thank you!


I figured it out:

Code:
                GameObject shapeExtrusionGameObject = GameObject.FindGameObjectWithTag("ShapeExtrusion");
                BuildShapeExtrusion buildShapeExtrusion = shapeExtrusionGameObject.GetComponent<BuildShapeExtrusion>();
           
                volumeController.Volume = new CGDataReference(buildShapeExtrusion, "Volume");
Reply
#3
Hi,
Glad to read that you found the solution. Feel free to ask if you have other questions.
Have a nice day.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Nested Spline Volume Spot Instantiation merobbins5 3 6 07-26-2024, 09:58 AM
Last Post: _Aka_
  How to use CG Volume Controller j95677 5 11 07-17-2024, 07:15 PM
Last Post: j95677
  How to start volume spots at the end of spline instead of front j95677 1 5 07-07-2024, 04:58 AM
Last Post: _Aka_
Question Volume Spots inter group distance Sacryn 1 3 02-27-2024, 04:08 PM
Last Post: _Aka_

Forum Jump: