playMaker

Author Topic: Problem with Object reference, Sub-FSM and custom action  (Read 1409 times)

jashan

  • Playmaker Newbie
  • *
  • Posts: 5
    • View Profile
Problem with Object reference, Sub-FSM and custom action
« on: April 18, 2013, 09:43:25 AM »
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?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14684
  • Official Playmaker Support
    • View Profile
Re: Problem with Object reference, Sub-FSM and custom action
« Reply #1 on: April 21, 2013, 10:28:05 PM »
Hi,

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

bye,

 Jean