playMaker

Author Topic: Unity 2D and Physics 2D Support now available  (Read 39577 times)

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Unity 2D and Physics 2D Support now available
« Reply #45 on: January 30, 2014, 09:23:02 PM »
The "PlayMaker Unity 2D" Prefab needs to exist exactly *once* in every scene.

The PlayMakerUnity2DProxy component needs to be added to every 2D gameobject that you want Playmaker to detect 2D collisions / triggers on.

Perhaps confusion might come from some of the wording as Jean has sometimes called the prefab component the Proxy (while in the package the Proxy is the component you must add to each gameobject).

Okay thanks. That certainly clears that up. The problem is that I'm getting the errors even after I've done all that. I'm using objects with children, and I'm only adding the proxy to parts of an object that use 2D triggers. Why would I still be getting these error messages? Does anyone know why?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Unity 2D and Physics 2D Support now available
« Reply #46 on: January 31, 2014, 07:23:32 AM »
hi,

 Yeah, Thanks Dasbin for clarfiying :)

bye,

 Jean

xhidnoda

  • Full Member
  • ***
  • Posts: 231
Re: Unity 2D and Physics 2D Support now available
« Reply #47 on: January 31, 2014, 09:31:03 AM »
Jean..!
What happen of this?
"I am currently working on refactoring the Unity 2D game Sample from the asset store"
  ::)

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Unity 2D and Physics 2D Support now available
« Reply #48 on: January 31, 2014, 02:24:02 PM »
hi,

 Yeah, Thanks Dasbin for clarfiying :)

bye,

 Jean

Why would I still be getting these error messages? Does anyone know why?

My question still remains: "Why would I still be getting these error messages? Does anyone know why?

NullReferenceException: Object reference not set to an instance of an object
PlayMakerUnity2d.OnLevelWasLoaded (Int32 level) (at Assets/Assets/PlayMaker Unity 2D/Scripts/PlayMakerUnity2d.cs:89)

NullReferenceException: Object reference not set to an instance of an object
PlayMakerUnity2DProxy.OnTriggerEnter2D (UnityEngine.Collider2D coll) (at Assets/Assets/PlayMaker Unity 2D/Components/PlayMakerUnity2DProxy.cs:159)
"

dasbin

  • Junior Playmaker
  • **
  • Posts: 92
Re: Unity 2D and Physics 2D Support now available
« Reply #49 on: January 31, 2014, 04:24:29 PM »
Looking through Jean's code in those sections, these are my best guesses:

- Your first error might be caused by not having the level in your Build Settings.

- The second error might be caused by not having a 2D Collider component attached to the other object (maybe just a Rigidbody2D with no collider?)

Just guesses.
If you still have trouble send me your scene packaged up and I will take a look.
« Last Edit: January 31, 2014, 04:27:10 PM by dasbin »

Wledig

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Unity 2D and Physics 2D Support now available
« Reply #50 on: February 01, 2014, 07:14:55 AM »
Hi,

First, I'm sorry if it is the wrong topic to post this on, but I think there is a slight mistake on the wiki page.

I'm new to Unity and Playmaker, and when I wanted to set up Playmaker to work with Unity2D, I downloaded the Unity2D playmaker package and followed the instructions. But this got me confused:

Quote
Scene Setup

In order for Fsm to receive Physics 2d global event, a "PlayMaker Unity 2D" Prefab needs to be present at all time in the scene.

Use the Menu "PlayMaker/Addons/Unity 2D/Components/Add PlayMakerUnity2DProxy to Selection" to do so conveniently.

Game Object using Physics 2D Setup

In order for Fsm to receive Physics 2d global event, you need to drop a "PlayMakerUnity2DProxy" component on that GameObject. Then, any Fsm on that GameObject will be able to implement the global events "TRIGGER XXX 2D" and "COLLISION XXX 2D". The proxy is also used to store raycasting infos. Any other actions do not requires the proxy component, for example, AddForce2d works fine as is.

Use the Menu "PlayMaker/Addons/Unity 2D/Components/Add PlayMakerUnity2D to Scene" to do so conveniently.

I think you should swap these two lines. I know it's probably obvious for the average guy, but being a complete newbie (and a bit dumb), I really got confused with "PlayMakerUnity2DProxy" and "PlayMakerUnity2D"'s functions.

Other than that, I'd really like to thank you and this community for having built one of the best Unity Assets. It's so simple to understand yet so powerful.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Unity 2D and Physics 2D Support now available
« Reply #51 on: February 03, 2014, 04:10:55 AM »
Hi,

 -- @xhidnoda: Doing to 2d animation demo in playmaker is something on the list, so it will be coming soon.

-- @Wledig: Could you rephrase how you would like this to be explained? cheers.

bye,

 Jean
 

Wledig

  • Playmaker Newbie
  • *
  • Posts: 7
Re: Unity 2D and Physics 2D Support now available
« Reply #52 on: February 03, 2014, 05:56:49 AM »
Well, when setting up the scene, you tell us to add a PlayMakerUnity2D to the scene but you wrote "Use the Menu "PlayMaker/Addons/Unity 2D/Components/Add PlayMakerUnity2DProxy to Selection" to do so conveniently."

And then you wrote that we need to drop a PlayMakerUnity2DProxy on a GameObject , but then you put: "Use the Menu "PlayMaker/Addons/Unity 2D/Components/Add PlayMakerUnity2D to Scene" to do so conveniently."

I just think it's the other way round. Well that's how I understood it anyways.


_____________

Ben, tu as marqué que pour que FSM reçoive les événements globaux concernant la  physics 2D, on doit ajouter une prefab PlayMakerUnity2D à notre scène, mais tu dis que pour le faire il faut sélectionner dans le menu "Add PlayMakerUnity2DProxy to Selection".

Ensuite pour que le GameObject reçoive les événements globaux, tu dis qu'il faut y attacher PlayMakerUnity2DProxy, mais pour le faire il faut sélectionner dans le menu "PlayMaker/Addons/Unity 2D/Components/Add PlayMakerUnity2D to Scene".

Je pense juste que tu voulais dire l'inverse. Certaines personnes (un peu bêtes comme moi) pourraient croire qu'il faut ajouter le Proxy à la scène et le PlayMakerUnity2D à un GameObject. En gros inverser les deux lignes en gras. Non?

Sorry if I didn't express myself properly, that's no big deal anyways.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Unity 2D and Physics 2D Support now available
« Reply #53 on: February 03, 2014, 06:18:37 AM »
Salut,

 pardon, j'avais pas compris... c'est fait :)

bye,

 Jean

bkups2003

  • Playmaker Newbie
  • *
  • Posts: 49
Re: Unity 2D and Physics 2D Support now available
« Reply #54 on: February 09, 2014, 08:57:54 PM »
Hi,

I have been using the 2D physics in a 3d environment (2.5d game) and so far no problems. But i did see that error telling me to add the 2dproxy to the scene. Is it required if i will not be playing animations on anything 2d? I'm making a 3.5d game and the 2d physics are much better performance wise so that was my choice.

dasbin

  • Junior Playmaker
  • **
  • Posts: 92
Re: Unity 2D and Physics 2D Support now available
« Reply #55 on: February 10, 2014, 02:01:48 AM »
It's nothing to do with animations - it's required if you want your 2D physics objects to receive Trigger and Collision events via Playmaker. That's it.

lefton22

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Unity 2D and Physics 2D Support now available
« Reply #56 on: May 08, 2014, 11:59:13 PM »
But can't find Hinge Joint 2d or other 2d property?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Unity 2D and Physics 2D Support now available
« Reply #57 on: May 09, 2014, 12:31:46 AM »
Hi,

 you have to use "set property" or "get property" actions, and then you can point to the hinge2d component and access all it's public variables.


 Have you tried that?

bye,

 Jean

lefton22

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Unity 2D and Physics 2D Support now available
« Reply #58 on: May 12, 2014, 10:50:41 AM »
very thanks for answer, but there's no property of hinge2d in "set property" or "get property" yet:

or can i find the hinge2d component in other place? :-[
thanks very much!

Hi,

 you have to use "set property" or "get property" actions, and then you can point to the hinge2d component and access all it's public variables.


 Have you tried that?

bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Unity 2D and Physics 2D Support now available
« Reply #59 on: May 13, 2014, 08:37:15 AM »
Hi,

 can you do a screenshot of the action without the popup so that I can see if you are targeting properly the hinge. to me it still is that you don't rag it properly ( drag visually the hinge component bar itself, nothing else.

bye,

 Jean