How to get object Y from scene Y, within scene X

Hi, how to get object Y from scene Y within scene X with Python.
I mean that getCurrentScene.getObject tells me that object Y is not found…thats is because its in scene Y, but how to access this object ?
P.S. I’ve add scene Y like overlay scene when the game starts and everything else but its not working, help?

I haven’t tryed using that python function before, so im not sure what could be generating the error.

But a possible work around could be to just set the object to be linked between the 2 scenes?

something I would also like to know… sorry I can’t be of more help here. What version of GE are you using. I do know they have made changes in apricot to carry over values between blends\scenes using python… but I haven’t seen any examples yet.

If it’s an overlay scene it still won’t be found in getCurrentScene, simply because it’s not in the scene, it’s visible as an overlay, but it’s not literally there.

This problem was discussed manytimes and I have never seen a good solution of this. But I think there is always other way to do what you want in BGE.

You could try using separate layers and adding/removing objects to and from them.

Hm, I’m guessing you’re trying to get information from the overlay scene to the main scene or vice-versa.
You can do this by creating an attribute for GameLogic like so: = data

And then use it like you would a property on own, e.g. = 12

If you didn’t want to get the information across scenes but wanted to directly interact with an object try storing the objects data in, e.g. = GameLogic.getCurrentScene().getObjectList()[“OBCube”]

See if that works.

from the current scene run this script:

import GameLogic
c = GameLogic.getCurrentController()
o = c.getOwner()
#this is the cube located in the overlay scene:
overlay_cube = GameLogic.sceneoverlay.getObjectList()["OBCube.001"] 
#we will set our cube's orientation to the overlaying cube's
o.orientation = overlay_cube.orientation

From the overlay scene run this script:

import GameLogic
#here we will export the scene to a global variable
GameLogic.sceneoverlay = GameLogic.getCurrentScene()

search really is your friend, he told me you werent looking hard enought >: (