keijiro / KlakSpout

Spout plugin for Unity
The Unlicense
673 stars 101 forks source link

Any way to set source static? #83

Closed ubergeekseven closed 2 years ago

ubergeekseven commented 2 years ago

I am attempting to set the source to always be from the same sender application. I cannot figure out how to set it static in the code and the end users do not have input.

keijiro commented 2 years ago

Sorry but I can't understand what's needed. The source name in the SpoutReceiver component is "static". No one other than you changes it.

ubergeekseven commented 2 years ago

Do you have to manually choose the source from the dropdown or will the plugin grab any spout that exists on start? I can easily select a source in editor but, if I had multiple sources available and wanted to assign one source to the receiver always. How could that be done?

ubergeekseven commented 2 years ago

ok. I finally messed around enough to get this working for me. I did not want to mess with the Source selector code at first. Then I just decided to try anything until I could pass my own through.

So, since the dropdown exists within the source selector script and sends that through to the spout receiver component, I removed the update code for the selector script. I could not get it to pass through using anything that way. My problem, I do not fully understand everything you did throughout the library and it works amazingly well. Thanks for all of the work put into it.

I then had to add the source selector script to the spoutrenderer object in the scene. Then it finally passed through my string to the source name on game start instead of waiting for input from the dropdown. I modified Start() to be this:

void Start() { _receiver = GetComponent<SpoutReceiver>(); _receiver.sourceName = BaseSource; }

and created a public string called BaseSource to change in the editor and have access to in game if input is needed without populating a list of the available senders that may exist.

I was kind of freaking out because your library allowed me to do what I needed except for this one thing and it was the only thing I absolutely needed to do. I just figured I could pass it through without having to attach that script since it was already being passed. I guess it could if I forked your repository and created another class to handle that. Since it is added through the manifest, I cannot change anything without it reverting.

Are you only using this in editor or do you access a list in game when compiled?

keijiro commented 2 years ago
ubergeekseven commented 2 years ago

Thank you for the reply. I did eventually figure out how to do that.

On Wed, Mar 9, 2022, 8:01 PM Keijiro Takahashi @.***> wrote:

  • You shouldn't use Source Selector. It's just sample code showing how to interactively select a Spout source. It's only useful when you want to select a source at runtime.
  • You can edit the Source Name field of a Spout Receiver component without using the dropdown.
  • So, what you should do is just editing the Source Name field manually. Then you app tries to connect to a fixed Spout source every time.

— Reply to this email directly, view it on GitHub https://github.com/keijiro/KlakSpout/issues/83#issuecomment-1063536505, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQ2VBC72IJ4NXA6JO7AMKDU7FCW7ANCNFSM5QJRZDRQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you modified the open/close state.Message ID: @.***>