What I'm doing wrong with my code?
I'm trying to make my first script, I want that when someone touch the screen, a Sprite in a billboard will appear.
I've made this simple code:
// -----JS CODE-----
//@input bool active
//@input Asset.Texture texture
script.spriteVisual.mainPass.baseTex = script.texture;
if (script.active == false)
{
script.spriteVisual.enabled = true;
script.active==true;
}
I made a boolean because I only want it to execute 1 time, and i created a texture input because i want to just put my texture to overlay there, but in console I get this error:
17:41:20 TypeError: cannot read property 'mainPass' of undefined
at [anon] (Scripts/Overlay:5) preventsyield
What I'm doing wrong?
Also, by default the sprite is hidden, so it should show when the screen is tapped
Travis please I love you
nevermind i fixed using this:
@input Component.SpriteVisual spriteVisual
and this
script.spriteVisual.enabled = true;
Nice solve! Also, lol.