Create image from scene object

Kinie Kusuma
Kinie Kusuma Posts: 1
edited September 2022 in Programming #1

Is there any ways to create an image from scene object or components inside scene object programmatically? i want to make my scene object become background

Answers

  • Max
    Max Posts: 26 🔥

    Yes! You can use createComponent on it, like so:

    //@input SceneObject obj
    //@input Asset.Texture tex
    var img = script.obj.createComponent("Component.Image");
    img.mainPass.baseTex = script.tex;