Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new script instance for each script layer #2182

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

cvb941
Copy link
Contributor

@cvb941 cvb941 commented Sep 19, 2020

As far as I know, currently the user script files are compiled and instanced once during the startup. This forces you to use the same shared state between multiple script layers.

In this pull request, I propose to let each layer have its own instance of the script.

This way, I can have each script layer have its own connection to a web service, where they can get different values based on what I define in the script layer parameters.

This pull request proposes the following changes:

  • EffectScripts dictionary values type changed from IEffectScript to Func<IEffectScript>, which is a factory function returning a new instance of IEffectScript

Known issues/To do:
I implemented this in the smallest way change-wise. The code could be more broadly redone to accomodate this change.

Also, the whole idea in the first place is up for discussion: Is this change even desirable? Or is there already another way to achieve this?

Please comment and feel free to edit. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant