Sign In Register

How can we help you today?

Start a new topic
Answered

Running GS functionalities in Editor

Hi,


I am trying to retrieve the list of VirtualGoods from the editor (not in play mode).

Any idea how to do that?


I need the GS Instance to be initialised, I tried to just tag the default platform with [ExecuteInEditMode] but it makes strange things (for example the gameobject which holds my GameSparkUnity component just disappears from the scene...)


Thank you in advance,

Stéphane



Best Answer

Hi Oisin,

Yes, I would like to be able to call listVirtualGood from the editor, without entering playmode.

Basically I would like to be able to create some tools in the editor that interact with the game spark server.


So far I managed to achieve what I want by entering playmode. But this is not ideal...


Hi Stephane,


Do you mean from the Unity editor without entering play mode?

That would depend on what way you have your scene setup and why your GameSparkUnity component disappears.


Otherwise you can do a listvirtualgoodsrequest from the test harness on the portal.


Thanks,


Oisin

Answer

Hi Oisin,

Yes, I would like to be able to call listVirtualGood from the editor, without entering playmode.

Basically I would like to be able to create some tools in the editor that interact with the game spark server.


So far I managed to achieve what I want by entering playmode. But this is not ideal...

lool That is not an answer ^^
I exactly want to NOT do it in playmode, so I can build tools for the editor side. 

Bump, because this has no real answer. Is it possible to use the default WebSocket setup in the Editor without being in play mode? I was pointed at REST, but that adds a layer of complication that I'd rather not deal with.


The current documentation on this is insufficient.

I know this is old, but might help some other person. It can be done, "quite" easy.
I've not had the time to do it properly, but the key is to call DefaultPlatform.Start() (once while in Editor Mode) and then make your Requests. After that, you need to manually "poll" the DefaultPlatform.Update() since there is now requests queued wanting to be run on the "Unity Main Thread", but since you are in edit mode, Update() won't be called every frame like usually, so you need to poll til the queue is empty (or when you think the request is done).

Login to post a comment