Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: jashan on April 18, 2013, 12:43:25 PM

Title: Problem with Object reference, Sub-FSM and custom action
Post by: jashan on April 18, 2013, 12:43:25 PM
I've received a report today from a user that's using ScoreFlash and its PlayMaker-integration. The issue was that when he used a specific ScoreFlash instance in his action, which is in a sub-fsm, the messages were not shown. Everything else works fine (i.e. using the default score flash instance in a sub-fsm, or using a reference or default score flash instance in the main fsm).

So, I investigated the issue and it turned out that as far as I can tell, the reference to the ScoreFlash instance in the action in the sub-fsm points to an object that's no longer "living" inside Unity. In other words: It seems that for some reason, there's suddenly two instances with the same name and same ID - but one is "alive in Unity", and the other is not.

So, I thought the problem was that I use

Code: [Select]
public ScoreFlash scoreFlashInstance;
in my action, instead of using:

Code: [Select]
[ObjectType(typeof(ScoreFlash))]
public FsmObject scoreFlashInstance;

... but I've tried both now, and it doesn't seem to make a difference (except for the latter making it possible to assign a variable - which is actually not what I want ;-) ).

Basically, it seems that sub-fsms are doing "something" that results in the reference to the score flash instance (which is a simple MonoBehaviour attached to a game object) to point to Nirvana. It does work when not assigning an instance because ScoreFlash can also be used as a singleton (and that reference always points to the correct instance).

So ... any ideas what might be causing this?
Title: Re: Problem with Object reference, Sub-FSM and custom action
Post by: jeanfabre on April 22, 2013, 01:28:05 AM
Hi,

 without a testing scene, it's going to be hard. Pm me, and I will help you debugging this.

bye,

 Jean