Hi, it's me again.
I'm using the volume spot creation with the generator, and can't really figure out how I would change the volume spot gameobject's material's color on spline creation.
As you saw in my last post, each of my splines are created at runtime and generate volume spots as I "draw" the spline. I tried grabbing the gameobject from the generator volume spots component, then creating a new material with my new color, then applying it to said object. It works the first time, but when I "Stop" my game, the gameobject prefab loses its material and now gives an error when I run it afterwards and have to manually re-apply the material.
Then I thought instead I can maybe change the color as the generator is creating instances of my gameobject using the Volume Spots Event system, but this is where I'm stuck. I have no idea how to use the event callbacks. I looked at the API, but there's not really any info on how to use "CurvyCGEventArgs" for example.
Is creating a callback event the best way to modify the color of each instanced gameobject on the spline (they will all be the same color)? If so, what would the function look like in my scirpt?
Here's what I tried, which is obviously wrong
Also, is there a way I can somehow donate money to you or something? You've been a great help and it's so nice to have developers answer customer questions so quickly. And I feel bad asking so many questions...
FYI: I could never leave a review on your asset in the store (or any other for that matter). It always says "Please download this asset to leave a review". Not sure how to "download" your asset, but I've downloaded it with the "Open in Unity" button.
I'm using the volume spot creation with the generator, and can't really figure out how I would change the volume spot gameobject's material's color on spline creation.
As you saw in my last post, each of my splines are created at runtime and generate volume spots as I "draw" the spline. I tried grabbing the gameobject from the generator volume spots component, then creating a new material with my new color, then applying it to said object. It works the first time, but when I "Stop" my game, the gameobject prefab loses its material and now gives an error when I run it afterwards and have to manually re-apply the material.
Then I thought instead I can maybe change the color as the generator is creating instances of my gameobject using the Volume Spots Event system, but this is where I'm stuck. I have no idea how to use the event callbacks. I looked at the API, but there's not really any info on how to use "CurvyCGEventArgs" for example.
Is creating a callback event the best way to modify the color of each instanced gameobject on the spline (they will all be the same color)? If so, what would the function look like in my scirpt?
Here's what I tried, which is obviously wrong
Code:
public CurvyCGEventArgs ChangeVolumeSpotColor(evt newgameobject)
{
newgameobject.getcomponent<MeshRenderer>().material....
}
Also, is there a way I can somehow donate money to you or something? You've been a great help and it's so nice to have developers answer customer questions so quickly. And I feel bad asking so many questions...
FYI: I could never leave a review on your asset in the store (or any other for that matter). It always says "Please download this asset to leave a review". Not sure how to "download" your asset, but I've downloaded it with the "Open in Unity" button.