You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
578 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class ColourCollide : MonoBehaviour
  5. {
  6. public Texture newTexture;
  7. [SerializeField]
  8. [Tooltip("Layers to ignore when checking for blocks")]
  9. private LayerMask Ignore;
  10. public Block CurrentBlock;
  11. public Renderer abc;
  12. void Update()
  13. {
  14. Block.isBlockAtPosition(transform.position + Vector3.down / 2, 0.5f, ~Ignore, out CurrentBlock);
  15. abc = CurrentBlock.GetComponent<Renderer>();
  16. if(abc.material != newTexture){
  17. abc.material.SetTexture("_Albedo", newTexture);
  18. }
  19. }
  20. }