playMaker

Author Topic: Prefabs Deleting information  (Read 1134 times)

misterjuly

  • Sr. Member
  • ****
  • Posts: 336
Prefabs Deleting information
« on: March 22, 2022, 10:49:35 PM »
Hello,

I'm following a tutorial on youtube to implement online functionality into my game. However, when I put my player in the prefabs area, every-time I reference it, it gets deleted in the FSMs. I know you can use specific actions and game object variables to reference the prefab, but would it work to manually fill in everything that got deleted? I know it is a lot of work, but so is making game object variables for everything. Thanks!

John Bassi

John Bassi

misterjuly

  • Sr. Member
  • ****
  • Posts: 336
Re: Prefabs Deleting information
« Reply #1 on: March 23, 2022, 08:57:11 PM »
Bump.

andyandyandy

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Prefabs Deleting information
« Reply #2 on: March 23, 2022, 09:57:42 PM »
Yeah when is a prefab, is not going to connect anything from the game cause it may break unity. You need to manually use "set fsm" states to input all the data you want your prefab to have before or after the prefab is created.

Like when I summon my prefab player, Right after "create game object" state, I input all the data in sequence mode. Or what you can do is when you summon your prefab, you can run the fsm in your prefab to find all game object with the fsm you need to collect.

misterjuly

  • Sr. Member
  • ****
  • Posts: 336
Re: Prefabs Deleting information
« Reply #3 on: March 24, 2022, 06:57:16 AM »
So, if I wanted to do your second suggestion, I would make sure that all game objects I’m referencing in the fsm are prefabs, then make all the game objects that have fsms prefabs, then use the find game object actions to find the game objects? Would I only have to do it once, possibly every frame?

Thanks!

andyandyandy

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 63
Re: Prefabs Deleting information
« Reply #4 on: March 24, 2022, 12:40:08 PM »
So, if I wanted to do your second suggestion, I would make sure that all game objects I’m referencing in the fsm are prefabs, then make all the game objects that have fsms prefabs, then use the find game object actions to find the game objects? Would I only have to do it once, possibly every frame?

Thanks!
You only need to get it once, not every frame. You can add them into a array on global and have your prefab find them easier if you want. Finding state takes alot of processing power if you got alot of stuff.

misterjuly

  • Sr. Member
  • ****
  • Posts: 336
Re: Prefabs Deleting information
« Reply #5 on: March 24, 2022, 09:56:27 PM »
Ok. I’m going to hopefully give it a shot tomorrow. And if I have any more questions, I’ll let you know. Thanks for your help!