Hi, I have a main scene with player and enemies. I added both enemy and player scene under main scene in the editor. Now in script I can access the position of player with following code
Now the thing is I removed the player added in the editor. And now I am adding the same player at runtime by instancing it.
export (PackedScene) var Enemy
var player = Player.instance()
Now I try to get the position of player as follows
It is not working as expected.The error is
Invalid get index 'position' (on Base: 'null instance')
Any solution. Thanks in advance....