Search Unity

Deleting Unlit/Texture (Instance) at runtime

Discussion in 'Scripting' started by trijays, Jul 4, 2022.

  1. trijays

    trijays

    Joined:
    Jun 8, 2022
    Posts:
    1
    I'm trying to delete the Unlit/Texture (Instance) which is dynamically created. I'm trying to do this so that the agora creates the textures again from the scratch and the video is rendered on the cube itself. I have tried to use destroy like given below

    Code (CSharp):
    1. Destroy(cube.GetComponent("Unlit/Texture"));
    Code (CSharp):
    1. Destroy(cube.material.mainTexture);
    Can someone please let me know if this is possible?