edited July 2014 in ORK Support
I need the player already in the scene,so i can't use the spawn point to place the player in the scene when it starts,and my character can't interact with items anymore,only if i use the spawn point...I really need a solution for it,srry my bad english;)
Post edited by gamingislove on
  • edited July 2014
    I found this in another thread---

    "the player is spawned by ORK and not available in the scene before that"

    Why do you need your player already in the scene? Maybe there's a different way to do what you want to do and still use a start event to spawn the real player.
    Post edited by Catacomber on
  • If you need the player already in your scene to reference him in components, I'd recommend changing your scripts and use this code to get the player's game object:

    GameObject player = ORK.Game.GetPlayer();

    Otherwise you'll have to do some things on your own, e.g. adding the Interaction Controller that's needed for interacting with stuff, setting your game object as the player (without that there's a lot not working), etc.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited July 2014
    I've tried to use this code,but the bug still persists,is there another way to do it? Because if i use the spawn point to place the player in the scene when it starts,i'll get lots of errors,like null reference exception,specially cuz i'm using UniStorm,so i definitely need my player object in the scene.And i'm not very good in programming,so,i can't edit all UniStorm source..
    Post edited by RicK on
  • I'm curious, why do you need your player object in the scene? If it's something simple like needing it for your camera script, you should just modify your camera script to recognize an instantiated object rather than something already present in the scene.
    Tactics RPG Grid Battle System for ORK
    ---------------------------------------
    Personal Twitter: https://twitter.com/AMO_Crate
    I make RFI! https://twitter.com/NootboxGames
  • If there's a way to assign a gameObject to a variable via script at runtime,my problem is solved,i think.
  • Any ideas?I still have the problem and can't make any progress in my game with this. :/
  • edited July 2014
    If you could tell us why you want your player in the scene at the getgo maybe we could help you do a walk around. Or maybe gamingislove could help you.

    I know I'd like to help if I could and am sure everybody else here feels the same way.

    But you haven't told us why you want your player in the scene from initio.

    There might be another way to do what you want to do.

    Personally I wouldn't want my player in the scene at the beginning because it takes away from all the stuff I can do in dialogues introducing my player before s(h)e's instantiated.

    And giving players choices about what they might want to do as a player. A/k/a whether they are a certain class or male or female etc.

    But if you need to have the player there, giving us a hint might help or maybe it wouldn't but we could try and not just sit on the sidelines sobbing because we can't help you.
    Post edited by Catacomber on
  • edited July 2014
    ORK is designed to spawn the player itself and not having him in the scene before that - getting rid of that wont be easy and has a load of consequences throughout the framework.

    The code I've posted will always get you the player object (if spawned). I'd recommend using that code whenever you need the player and not only once (e.g. in the Awake or Start function of a component), because the player might not be spawned at that time.
    E.g. if you need the player in the Update function of a component, get him there using the code.

    I don't use UniStorm, so I don't really have information on how to go about it there, but if you need to reference the player there, you'd only need to change the script where you assign the player.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I fixed it by writing a simple script to assign the instantiated objects to my variables when the game starts.Thank you guys for the fast answers!!And thanks GaminIsLove for this awesome framework,now i can get my game going again!!
Sign In or Register to comment.