Wrong Argument Number Count
I have completed my lens and everything runs properly in the preview and when I push it, but I cannot publish it because of the following error:
16:59:08 Error: Wrong argument number count, expected 1, got 2
at [anon] () native strict preventsyield
at onTap (BillboardSprite:34) preventsyield
I am using Travis Chen's Billboard Sprite script (in an empty object in the objects panel) which turns on a billboard with a video animation when tapped (https://lensstudio.zendesk.com/hc/en-us/community/posts/360000035023-Tap-to-Trigger-Billboard-and-Sound). Line 34 is "control.play(1, 0.0)" in the following:
[code]
// Play animation
var control = script.billboardSprite.getMaterial(0).getPass(0).baseTex.control;
if( control && control.play )
{
control.play(1, 0.0);
}
}
[/code]
On the sprite itself, I have the following script to prompt the video texture on the billboard to only play once:
[/code]
// -----JS CODE-----
// Plays a video texture
//@input Asset.Texture movie
var loops = 1;
var provider = script.movie.control;
provider.play(loops);
[/code]
I also have a tweenalpha on that billboard which is set to play automatically (no loop). I know I have everything assigned correctly in the inspector, since everything runs perfectly, so I assume it may just be an issue with the BillboardSprite code - which I haven't edited in any way.
I am willing to privately share my file if necessary! Thanks!
Hey Jessica,
I created a private thread and share the fixed project files over there.
But for anyone who has the same problem, The problem is for the video texture its the best to check the video state before playing the video.
You can do it like this:
Hello Jessie,
Can you replace the way you play your animated texture from what you have to this one and see if you can get it to working:
In this way all you need to do is to assign your animated texture to the sprite and then assign the sprite to this script.
Hope this will help you to fix the problem
Amir.
Amir - that would be replacing the following script, correct?
// -----JS CODE-----
// Plays a video texture
//@input Asset.Texture movie
var loops = 1;
var provider = script.movie.control;
provider.play(loops);
Also, that script is making me assign a sprite visual (which has to be a sprite object) and a scene object (which also has to be a sprite object). Do I have to assign the same sprite to both? The video is already assigned to the texture of that sprite, by the way. I tried assigning the same script to both spots but it would not run.
Hey Jessie,
No that's actually would be a replacing for your play animation code.
Also can you please share your project file if it didn't help you to fix the problem.
Best,
Amir.
That didn't work but I can share the file - if you can send me an email at ****** I will respond with the file (from when it was still working, but had the error) for you to try to adjust!
Thanks!
Hey Jessie,
I created a private thread that you can send me the file over there.
You should get an email and we can follow up offline.
Best,
Amir.
Hi Amir, I'm also having a problem with this issue
When I input my code
// -----JS CODE-----
// @input Component.SpriteVisual meme
script.meme.enabled = true
var provider = script.meme.mainPass.baseTex.control;
provider.play(1,0);
I also get the error
Error: Wrong argument number count, expected 1, got 2
at [anon] () native strict preventsyield
at [anon] (Script:6) preventsyield
when I change the play(1,0) to play(1) it works when I tap the preview, however it says "calling play from invalid state"
I'm not sure how I can get the video texture to work with the script because I just want to play a video texture by tapping the screen.
Thanks
Hey Jessica,
Your script looks fine but you can check if the file is animated texture then start to play it to avoid the error logs.
In order to do that update your script to be like below:
Hi Amir,
When I inputed that script the log said
ReferenceError: identifier 'isAnimated' undefined
at [anon] (Script:11) preventsyield
I'm not sure what to do from there,
sorry for the trouble.
Hey Jessica,
Can you please share your project file so I can investigate on it?
Best,
Amir.
Hi Amir,
I can share the file on google drive
https://drive.google.com/open?id=1bBuXcTIJNrpuWvcyMLBd1K2rCT8BUZi5
if you copy and paste the link it should work, the hyperlink doesn't work
Thanks so much!
Hey,
Can you please double check the URL?
Im getting Error 404 (Not Found).
Best,
Amir.
It should work, when I copy and paste the link it loads up.
If it doesn't work can I send it to you through an email?
I'll send the link again, maybe it'll work this time
https://drive.google.com/open?id=1bBuXcTIJNrpuWvcyMLBd1K2rCT8BUZi5
thanks
Hey Jessica,
Yes the link is now working but you need to send me the whole project folder not only the .lsproj file.
Thanks,
Amir.
Hi Amir,
Sorry about that XD as you can tell i'm very new at this. I uploaded the whole folder so it should be there now.
Thanks!
Can you please send me the link of the folder?
Best,
A.
https://drive.google.com/open?id=1Vic4bynIvy4cYtVEQxz7IaaRPy-R0MGa
Here you go!
Hi Amir,
This fixed the problem for me, Thank you so much!!! ^^