playMaker

Author Topic: Global Variable assigned to Object  (Read 1802 times)

Melonwars

  • Playmaker Newbie
  • *
  • Posts: 1
Global Variable assigned to Object
« on: January 20, 2014, 06:30:57 AM »
Hello everybody,

I'm looking for a solution to the topic local/global variables.

I have several prefab cameras observing a game object. Each camera makes different "observations", e.g. records the game object's position. Now, each camera gets an observation different from the other camera in the scene. Nevertheless, each camera needs the data from all others.

With local variables this is not possible, moreover, I need to read them in a C# script.
If I use a global, each camera all the time overwrites the value.

Any ideas? I would be very grateful!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Global Variable assigned to Object
« Reply #1 on: January 20, 2014, 07:09:31 AM »
You can do it with local variables, just send or get the variables onto a proxy object that holds them. Probably more complicated this way but it works fine, I don't use globals at all.

I don't really understand your last part about the camera overwriting the variables. If you want the data constantly up to date then of course its going to overwrite the variable. You'll have to do some sort of work with it then store the result as a different variable so you don't inject bad data into the chain you're using to compute that data.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D