playMaker

Author Topic: [Solved]Convert FsmGameObject to GameObject Array (help)?  (Read 2711 times)

dudebxl

  • Hero Member
  • *****
  • Posts: 602
[Solved]Convert FsmGameObject to GameObject Array (help)?
« on: June 09, 2015, 09:23:54 AM »
Hi,

how do i convert an FsmGameObject to GameObject

private GameObject[] yyy;
public FsmGameObject[] xxx;

yyy = (FsmGameObject)xxx.Clone();

erro msg: Cannot implicitly convert type `HutongGames.PlayMaker.FsmGameObject' to `UnityEngine.GameObject[]'

Many thx
« Last Edit: June 09, 2015, 12:52:48 PM by dudebxl »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Convert FsmGameObject to GameObject Array (help)?
« Reply #1 on: June 09, 2015, 10:11:14 AM »
use

Code: [Select]
thisGameObject = myFsmGameObject.Value
Just add .Value when referencing an FsmVariable of any kind to access its... value.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Convert FsmGameObject to GameObject Array (help)?
« Reply #2 on: June 09, 2015, 10:54:28 AM »
Thx

I think i am having a slow day but I am unable to clone a FsmGameObject[] to GameObject[] using Value.

I can use a loop using .Value that but how would I use .Clone() (and convert) ?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Convert FsmGameObject to GameObject Array (help)?
« Reply #3 on: June 09, 2015, 10:58:55 AM »
Yes, you'll have to loop through the FsmGameObject[] array and assign them to the GameObject[] array accordingly by using the .Value reference on each element. I don't think you can clone in this case, but I may be wrong.

The code would be similar inside the loop, something like..

pseudo-code...
Code: [Select]
for (int i = 0; i < myGameObject.Length; i++)
{
myGameObject[i] = myFsmGameObject[i].Value;
}
« Last Edit: June 09, 2015, 11:10:33 AM by Lane »
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

dudebxl

  • Hero Member
  • *****
  • Posts: 602
Re: Convert FsmGameObject to GameObject Array (help)?
« Reply #4 on: June 09, 2015, 11:07:17 AM »
Thx for the feedback.  :D