playMaker

Author Topic: Array List Add (Not working on Prefabs) = SOLVED  (Read 2502 times)

Stain Corb

  • Junior Playmaker
  • **
  • Posts: 74
Array List Add (Not working on Prefabs) = SOLVED
« on: December 30, 2019, 08:28:14 PM »
So the current problem I have, is quite simple.

I have an NPC with an FSM (Array List Add)
The NPC needs to add its self to the Proxy list in object on scene.

My NPC work perfect event if I clone it a couple of times it adds its self to the proxy, it works !

THE PROBLEM: the instant I make my NPC a prefab, New spawned Prefab NPC wont add them selfs to Proxy list.

I got it to work with Normal Arrays, but I was not able to get arrays to work correctly and I cant see clearly whats being added in Array or removed.
So I though Array list has a perfect way to see all prefabs being added since you can see it, but array list wont work with prefabs.
« Last Edit: January 01, 2020, 03:27:54 PM by Stain Corb »

Stain Corb

  • Junior Playmaker
  • **
  • Posts: 74
Re: Array List Add (Not working on Prefabs)
« Reply #1 on: December 30, 2019, 08:59:07 PM »
I discovered that if I get the Prefab from the scene and not folder. and drag/add, it works.

Is this a bug ?
« Last Edit: December 31, 2019, 10:54:37 AM by Stain Corb »

Stain Corb

  • Junior Playmaker
  • **
  • Posts: 74
Re: Array List Add (Not working on Prefabs)
« Reply #2 on: December 31, 2019, 10:53:27 AM »
So I pinpointed out that any cloned prefab will never know ware the Proxy is no mater what I do.

1-I tried dragging object with Proxy into game object directly = Fail
2-Made a global variable on proxy as (Game var) then added that = Fail
3-Made local set game object, then added that variable = Fail

All these tests work with objects that are not Prefabs. I need them to work as spawned prefabs since I have scripts like (Destroy game object in 10 seconds) so my NPC will spawn perfect until game object is destroyed from scene then It cant read the object and wont spawn nothing.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Array List Add (Not working on Prefabs)
« Reply #3 on: January 01, 2020, 01:03:13 PM »
Hi.
prefabs can not communicate directly with gameobjects from a scene.
This is a unity limitation.

You can for example use find game object and find the World_FSMs

Stain Corb

  • Junior Playmaker
  • **
  • Posts: 74
Re: Array List Add (Not working on Prefabs)
« Reply #4 on: January 01, 2020, 03:27:09 PM »
Yeeeeesssssssssssssssss

Thank you so much djaydino, I can finally move on with this  :D

Good new year to you.