Settings and activity
5 results found
-
12 votes
An error occurred while saving the comment
abhinav_demkeys
shared this idea
·
-
18 votes
abhinav_demkeys
supported this idea
·
-
4 votes
abhinav_demkeys
shared this idea
·
-
26 votes
abhinav_demkeys
supported this idea
·
-
2 votes
abhinav_demkeys
shared this idea
·
I'm not sure if I should be adding this here or creating a new post for this but it's relating to SubscribeToCustomRewardEvents() so I'm gonna post it here and hope one of the devs sees it. In my original post I mentioned "SubscribeToCustomRewardEvents() is a member of 'Twitch.API'. So it should be 'Twitch.API.SubscribeToCustomRewardEvents()'.". This is true, however, in order to receive any events, you need to create an instance of TwitchSDKApi and call SubscribeToCustomRewardEvents() from that instance. Just calling 'Twitch.API.SubscribeToCustomRewardEvents()' doesn't give you any redeems. Sorry about the confusion. Here's my suggested version.
TwitchSDKApi api;
GameTask<EventStream<CustomRewardEvent>> customRewards;
void Start()
{
api = new TwitchSDKApi(""); // Add your own ClientID here.
customRewards = api.SubscribeToCustomRewardEvents();
}
void Update()
{
// If the 1 key is pressed.
if(Input.GetKeyDown(KeyCode.Alpha1))
{
CustomRewardEvent curReward;
// TryGetNextEvent returns a bool so we can use it
// in a if condition.
if(customRewards.MaybeResult.TryGetNextEvent(out curReward))
{
Debug.Log(curReward.CustomRewardTitle);
}
}
}