"Unity and Smartfox Best Of Both Worlds" How to integrate scores and currency?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

sanathkukkillaya
Posts: 3
Joined: 25 Jul 2022, 18:09

Re: "Unity and Smartfox Best Of Both Worlds" How to integrate scores and currency?

Postby sanathkukkillaya » 26 Jul 2022, 07:08

I have a slightly different question, but related to the Unity headless server itself, so I'm posting here.
I was able to setup a server and run it from smartfox by following the steps provided in the blog. However, I am not able to see any logs from the Unity headless server anywhere. I have tried both Unity's Debug.Log syntax as well as C#'s Console.WriteLine syntax. Is there any way we can see these logs in smartfox? Or should I try to view them somewhere else?
If possible, I would also like to know what is the best way to do this type of development so that I can debug and resolve issues during development as well as after it is goes to production.
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: "Unity and Smartfox Best Of Both Worlds" How to integrate scores and currency?

Postby Lapo » 26 Jul 2022, 07:56

@sanathkukkillaya
Since the Unity headless server runs in a separate process there's no direct way to pass its internal logs to SmartFox, unless you'd use a persistent connection towards SFS and send the log data through that channel and then log it via the standard logging in SFS.

Other than that you could simply write log messages to the local file system.
Here's a video that shows a way to implement it --> https://www.youtube.com/watch?v=A12GhwUxTrY

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
sanathkukkillaya
Posts: 3
Joined: 25 Jul 2022, 18:09

Re: "Unity and Smartfox Best Of Both Worlds" How to integrate scores and currency?

Postby sanathkukkillaya » 27 Jul 2022, 13:54

@Lapo, thanks for that quick reply. The tutorial on saving logs looks super helpful. However, I also have managed to establish a connection to the SFS server. But I was not clear regarding the standard logging via SFS.

I tried using Logger class in Unity, but that seems to be printing it to the Unity console rather than the smartfox logs. I tried EnablingEventDispatch to true, but still there was no logging on SFS. Should I send the log string as a SFS packet, and then log from the extension using trace?
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: "Unity and Smartfox Best Of Both Worlds" How to integrate scores and currency?

Postby Lapo » 27 Jul 2022, 15:52

The client is not supposed to generate log messages on the server, simply because you need to keep the two sides separated. They are two different contexts.

I understand your use case, but even in that case mixing the SFS2X logs with those of the headless Unity server would make consulting the logs way more complicated.

Generating separate logs is the way to go.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
sanathkukkillaya
Posts: 3
Joined: 25 Jul 2022, 18:09

Re: "Unity and Smartfox Best Of Both Worlds" How to integrate scores and currency?

Postby sanathkukkillaya » 28 Jul 2022, 05:25

What you say does make sense. Thanks for the clarifications.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 56 guests