playMaker

Author Topic: how do i spawn objects with fsm's that pull from scene fsm?  (Read 2406 times)

invayne

  • Full Member
  • ***
  • Posts: 105
how do i spawn objects with fsm's that pull from scene fsm?
« on: February 08, 2015, 08:06:18 AM »
so im having a little issue here every time i spawn my character i lose my  connection to my ui and my enemies. is there  a way to not lose connections when spawning players and enemies?

VascBogdan

  • Full Member
  • ***
  • Posts: 118
Re: how do i spawn objects with fsm's that pull from scene fsm?
« Reply #1 on: February 08, 2015, 10:58:14 AM »
I don't really understand what these conections are for you in your project, but make sure your character's FSM is asigned to it's prefab. Check if there is nothing disabled, too.
If this is not the problem, try to explain more.

invayne

  • Full Member
  • ***
  • Posts: 105
Re: how do i spawn objects with fsm's that pull from scene fsm?
« Reply #2 on: February 08, 2015, 08:38:22 PM »
basically its like this i have to set up some of my fsm with my fps controller int he scene so that i can add in the connections between fsm. when i apply everything to my prefabs and scene objects  an then delete the object from the scene i lose all my references  between the 2 objects fsm's. this is also the same for when trying to set up ugui in a different scene i lose all my references so i cant load it in as a level additive. also the same for when im trying to spawn  enemies into the scene i lose all references. they dont save no matter how many times i hit apply to update the prefab in the content browser .  this is a huge issue since i really need this to work properly in order to spawn waves of enemies. ive tried to drag and drop from content browser but i have set ups that are not visible in the prefab. i just need an idea of how to go about getting around this so that i can spawn stuff with out loss of hard coded game objects in the fsm's.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: how do i spawn objects with fsm's that pull from scene fsm?
« Reply #3 on: February 09, 2015, 03:25:41 PM »
You cant reference scene objects in Prefabs. This is a standard Unity rule... The Project Hierarchy is like a library while the Scene is like the park down the street. You can go get a book from the library and take it to the park, but the books in the library have no idea whats going on until they are put in the park. There is information about this both here and on the Unity forums.

Typically you use good practices to store relevant variables at the proper time to make it easy to communicate to/from them. For instance using Create Object and storing the result for later use, or Find Game Object, Collision Events, Trigger Events, Tag filtering, etc etc....
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

invayne

  • Full Member
  • ***
  • Posts: 105
Re: how do i spawn objects with fsm's that pull from scene fsm?
« Reply #4 on: February 09, 2015, 05:04:30 PM »
ok thanks thought i was just doing something wrong. ill work something out thanks

invayne

  • Full Member
  • ***
  • Posts: 105
Re: how do i spawn objects with fsm's that pull from scene fsm?
« Reply #5 on: February 10, 2015, 08:07:05 AM »
so i did as you said with the find game objects and get child ect ect . still having issues with losing connections. i can load my ui in as a level additive and if player is already in scene this works great but if player is spawned in it does not look for the object at all the find game object and get child get disabled
« Last Edit: February 10, 2015, 08:09:35 AM by invayne »

invayne

  • Full Member
  • ***
  • Posts: 105
Re: how do i spawn objects with fsm's that pull from scene fsm?
« Reply #6 on: February 10, 2015, 09:25:28 AM »
ok seems loading a level additive gives the same results as a deactivated object and will not allow fsm's to read their tags. fixed issue with spawned player basically as long as the player is spawned with my ui system it will connect to a ui thats in scene already. ray casting how ever is not affected by these things and works well with spawned objects and will find tags no matter what but the find game object and get tags auto deactivate when dealing with spawned objects. just figured i toss that out there for anyone who was wondering why it wasnt working ^^