add texture to component script

Hi everyone, I have to select a texture2D in a script component in runtime. Any suggestions?

Did you mean this?

public class SomeClass : MonoBehaviour
{
    [SerializeField] private Texture2D texture2D;

    private void Start()
    {
        // Do some stuff with texture...
    }
}

Based on the picture you provided, you’d need to access the script and it’s variable using GetComponent().basedOn = whatever texture you want to set;

@xxmariofer

Camera.main.GetComponent().BasedOn = otherTexture;

RISOLTO

Camera.main.GetComponent<UnityStandardAssets.ImageEffects.ColorCorrectionLookup>().basedOnTempTex = “Assets/Textures/Action.png”;