I have a grid-based battle. I want the grid to only appear around combatants, with an alpha fade in a range around them so that the grid appears to fade away from each combatant. I've been trying various ideas for a couple of days now without really getting anywhere - any suggestions as to how that might be implemented?

Thx :)
  • Individual grid cells are game objects with the cell prefabs spawned on them - so there should be a way to achieve that.

    I'm not really a shader expert, but there's probably something that can fade out stuff around a game object, so placing that on a combatant could be used to fade out the cells around.

    Alternatively, you can do this via schematics:
    - have your cell prefabs be fully transparent by default
    - use a turn start schematic to get cells around the combatant (Select Grid Cells node) and change their color (Change Color node)
    - fade out again in a turn end schematic
    This'd probably need more refinement, e.g. also doing this in grid move schematic to remove the correct cells again.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Cool, many thx for the reply - a couple more ideas to try out now! :)
  • edited September 22
    So still struggling to get anywhere with this...

    I think the core problem is that I can't find a way to get to the cell prefabs (since that's where I would want to change the color). I have the cell GameObjects - all the children of the Battle Grid. But the only components those have are their Transform and Battle Grid Cell Component.

    How do I find the actual cell prefabs that are linked to those? In both editor, and in-game, I just don't seem to be able to find a way to access those prefabs. They must be there somewhere, 'cos I see them in the game, and I can see in the code where they get instantiated. But I just don't find anything in the hierarchy - are they hidden somehow?

    Edit : So manged to get the exact effect I wanted, but in a quite hacky kind of way. I hide the grid completely, and then spawn/despawn vaious prefabs with differing levels of alpha around the player at the start/end their turn. I'm still curious to know, though, where the grid prefabs are, and why they don't appear in the hierarchy?

    image

    image
    Post edited by StevieJay on
  • The grid cell prefabs are child objects of the individual cell game objects of the grid. They're hidden in the hierarchy, but they're there.
    I.e. you can access their renderers by simply getting them from the grid cell's game object via child objects. E.g. the Change Color node changing colors of a renderer can control this via the Scope field, e.g. using All In Children.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.