bmlTUX

bmlTUX

  • Documentation
  • Install
  • Publication
  • Help
  • BioMotionLab
  • GitHub

›Documentation

Getting Started

  • Getting Started
  • Publication
  • Requirements
  • Overview
  • Installation

Tutorials

    Making your first experiment

    • Part 1: Tutorial Overview
    • Part 2: Creating a new Experiment
    • Part 3: Designing an Experiment
    • Part 4: Writing Runner Scripts
    • Part 5: Defining Blocks

Documentation

  • Creating an Experiment
  • Accessing GameObjects and Scripts in your Scene
  • Output
  • Setting Up Your Experiment's Behavior
  • Trial Class
  • Block Class
  • Experiment Class
  • Settings

Help

  • Troubleshooting
  • About Coroutines and IEnumerators

Advanced

  • Advanced Options
  • Recording Continuous Data
  • Using Standalone VR Headsets
  • Logging
  • Building to an Application
  • Customizing Further
  • Extras

Accessing GameObjects and Scripts in your Scene

The Experiment, Block, and Trialclasses reside in the voids of C# and don’t really interact with the unity system at all. For this reason, you need to create a link between your unity project and your custom trial script.

To do this, you need to create references to them in your custom ExperimentRunner class. For example:

public GameObject GameObjectThatMoves;  

Then, in your custom Trialscript you can reference your custom ExperimentRunner using the following

MyCustomExperimentRunner myRunner = (MyCustomExperimentRunner)Runner;

This line converts the generic ExperimentRunnerthat is stored in the Runner field into your customized version of the class.

Then you can access a GameObject, or other public unity field referenced within the customized ExperimentRunner class with:

GameObject gameObjectThatMoves = myRunner.GameObjectThatMoves;

This allows you to use your ExperimentRunner object as a container to drag and drop references to GameObjects and other things in your unity scene that need to be controlled or accessed during your experiment.

← Creating an ExperimentOutput →
bmlTUX
bmlTUX
DocumentationDownload
Facebook Open Source
Copyright © 2022 BioMotionLab (A.O. Bebko & N.F. Troje)