Saturday, April 1, 2023
HomeGame Developmentc# - change the alpha of a tilemap if the participant...

c# – change the alpha of a tilemap if the participant is in it in Unity


I am engaged on a 2D recreation and want to have it so once I’m getting into a constructing, the roof fades away. That is my present try, I would similar to to know easy methods to set the alpha of a tilemap via c#.

utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;

public class RoofTransparency : MonoBehaviour
{
    // Begin known as earlier than the primary body replace
    void Begin()
    {
        
    }

    // Replace known as as soon as per body
    void Replace()
    {
        
    }


    personal void OnTriggerEnter2D(Collider2D different)
    {
        Debug.Log("Inside constructing");

        tilemap.coloration = coloration(0, 255, 0);
    }

    void OnTriggerExit2D(Collider2D different)
    {
        Debug.Log("Outdoors constructing");
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments