playMaker

Author Topic: Prefab with create object issue?  (Read 2988 times)

justifun

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 280
Prefab with create object issue?
« on: July 17, 2011, 12:03:28 AM »
I'm having an issue when using a create object action in conjunction with a move towards using prefabs.

here's an example

Main Camera has a create object action which spawns a cube

The cube has a move towards that points towards another prefab object

the cube begins to move after being spawned, but travels to 0,0,0 instead of the location of the prefab instance that has been dragged into the scene from the project window and positioned somewhere in world space.

any ideas why the cube goes towards the origin?


EDIT: I think i partially answered my own question.... the move towards is moving the cube towards the world position of the prefab in the project window, not the one that is being spawned by the camera....  how do i get it to follow the one that gets created instead?

EDIT2: Ok, i figured out that i need to store the name of the object getting created as a game object variable when the player position when it gets created.... then use a "get fsm game object" action on the cube prefab, and have it lookup the name of the other prefab when its created.  then point the move towards action towards that new game object name instead.

The issue i'm still having now though, is that i can't use a non prefab game object (such as the main cam) in the get fsm game object action without playmaker giving an error about using a non prefab gameobject.

Why can't you use a non prefab in this situation?
it suggests you can use a "project resource" what is that?

thx
« Last Edit: July 17, 2011, 12:39:00 AM by justifun »

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Prefab with create object issue?
« Reply #1 on: July 17, 2011, 02:22:58 PM »
I'm just posting more downer feedback (  ;) )  but I just stopped using prefabs altogether if they have any connectivity with other objects.  They are an insane hassle when it comes to what can and can't reference each other.

For your camera issue though - I posted about this a couple weeks ago, and there is a way to reference the camera through a variable, which was my source of frustration with the prefab issue to begin with: http://hutonggames.com/playmakerforum/index.php?topic=366.msg1436#msg1436

Maybe that will help?  I hear they're overhauling prefabs for 3.4 or .5.  Hopefully that fixes some of the limitations.