line/line-sdk-unity

Request to Change the Timing of SetupSDK() Call in LineSDK.

Closed this issue · 2 comments

Is it a security issue?

No, this is not a security issue.

What did you do?

I am implementing a feature to change the channelID based on the env from an external class.

What did you expect?

I expected to be able to change the channelID after LineSDK.Awake() is called.

What happened actually?

Currently, SetupSDK() is called immediately after LineSDK.Awake(), which prevents me from implementing the feature as intended. When I try to implement it like LineSDK.Instance.channelID = _lineChannelId; from an external class, I get the following error: Exception: LINE SDK channel ID is not set.

Your environment?

I am using the latest versions of all packages, including the LINE SDK.

Sample project

Suggestion

Could you consider changing the calling of SetupSDK() from LineSDK.Awake() to LineSDK.Start()?
This change would allow for the channelID to be changed after LineSDK.Awake() is called, and prevent the error Exception: LINE SDK channel ID is not set. from occurring.


        void Awake() {
            if (instance == null) {
                instance = this;
            } else if (instance != this) {
                Destroy(gameObject);
            }
            DontDestroyOnLoad(gameObject);
        }

        void Start()
        {
            SetupSDK();
        }
LineSDK.Instance.channelID = _lineChannelId;

void Awake() {
if (instance == null) {
instance = this;
} else if (instance != this) {
Destroy(gameObject);
}
DontDestroyOnLoad(gameObject);
SetupSDK();
}

@k0uhe1D
Thanks for the suggestion. I will try to check what we can do to solve this!

1.4.0 was released with the related changes.

Thank you for reporting and helping to improve the project!