Closed clementshimizu closed 2 years ago
First of all, it's documented on README.md.
However, I suggest a different way of connecting the "blit shader", possibly loading from a "Resource" folder instead of the editor folder at startup, so the step I have to take is done automatically.
Use of the Resources folder is not recommended in general. At least, I should use Addressables instead of it. But I think most users are not familiar with Addressables, so I chose to use a "dumb way" to manage the resources.
I'm closing this issue now. Please feel free to reopen it for further problems.
Thank you! That helps
In my case, I had this error creating senders in texture mode via code, but it was fixed (in editor and also in build) adding a spoutsender to a GameObject and sending the Game View or a simple texture.
I'm using videos that are in the streaming assets folder.
NullReferenceException: Object reference not set to an instance of an object Klak.Spout.Blitter.GetMaterial (Klak.Spout.SpoutResources resrc) (at Library/PackageCache/jp.keijiro.klak.spout@2.0.3/Runtime/Internal/Utility.cs:45) Klak.Spout.Blitter.Blit (Klak.Spout.SpoutResources resrc, UnityEngine.Texture src, UnityEngine.RenderTexture dst, System.Boolean alpha) (at Library/PackageCache/jp.keijiro.klak.spout@2.0.3/Runtime/Internal/Utility.cs:25) Klak.Spout.SpoutSender.Update () (at Library/PackageCache/jp.keijiro.klak.spout@2.0.3/Runtime/SpoutSender.cs:112)
Having error in runtime and in game mode when I adding Spot Sender via scripting It works only in game mode when I add SpoutSender by my hands
Here is the script, I guess problem is on SpoutResorces
@AlexksGud You should set a valid instance of SpoutResources
, not an empty one.
@keijiro I know
" but you must give the
SpoutResources
asset (which holds references to the package assets) after
instantiation." -i didnt understand this in README
Anyway , I renamed Resources folder in Assets folder , and all works .
But there must be a better way to solve it
SpoutResources
is just a subclass of ScriptableObject
. I'd recommend checking ScriptableObject tutorials for details.
Klack Spout will not have access to SpoutResources if you add the spoutsender component from a script at runtime.
If I add spoutsender to a camera via scripting, it works fine in edit mode but fails in the build. The issue is that SpoutResources is connected via an editor script and saved in the editor folder which isn't accessible at runtime. It is stripped at compile-time.
I have this issue addressed in my project by the script function
"SpoutSender.SetResource(...)
.However, I suggest a different way of connecting the "blit shader", possibly loading from a "Resource" folder instead of the editor folder at startup, so the step I have to take is done automatically.
Thank you and I love your plugins.