Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing material of Volume spot at creation?
#1
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  Blush

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... Blush

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.
Reply


Messages In This Thread
Changing material of Volume spot at creation? - by _RicO - 08-09-2023, 09:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Set Volume to the Volume Controller at Runtime pako88 2 10 04-08-2024, 03:26 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
Question Volume Spots inter group distance Sacryn 1 3 02-27-2024, 04:08 PM
Last Post: _Aka_
  Changing Lanes Antonio 1 11 09-17-2023, 08:23 PM
Last Post: _Aka_

Forum Jump: