playMaker

Author Topic: ArrayList / Prefabs and "Obj Ref Not set to an instance of an object" [SOLVED]  (Read 2377 times)

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Hi,

I got a state on OBJ1 which check if an arraylist on OBJ2 is empty or not.

When OBJ1 is setup as a prefabs i got the following error :
(Not matter if OBJ2 is a prefab or not)

"Obj Reference is Not set to an instance of an object"

I don't get the error when OBJ1 is not a prefabs.
I assume this is something easily , but i don't get what is it.

Someone could give me some tips ?

regards


« Last Edit: July 17, 2015, 02:44:53 PM by vonpopov »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7621
    • jinxtergames
Hi,
prefabs can't interact directly with scene object.

you will have to find the object you want to interact with and save it as a variable(gameObject) and use that in you actions.

i believe its the action "Find game object" (i am not on a computer atm)

vonpopov

  • Junior Playmaker
  • **
  • Posts: 98
Hi,
prefabs can't interact directly with scene object.

you will have to find the object you want to interact with and save it as a variable(gameObject) and use that in you actions.

i believe its the action "Find game object" (i am not on a computer atm)

I did exactly what you said.

At idle state, it looks for a prefab in the scene by name (find game object action), then set that gameobject into a gameobject variable. Then i re-use that variable and ...

It works like a charm !

thanks you :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7621
    • jinxtergames
Hi,
I'm happy it worked,
can you edit your topic and ad [SOLVED]
thx