Xenko

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • Manual
  • API
  • Release notes
    Show / Hide Table of Contents

    Scripts

    Scripts are units of code that handle game events, respond to user input, and control entities. In short, scripts make games interactive by adding gameplay.

    You use scripts by adding them to entities in the scene as components. Xenko loads a script when the entity it is added to is loaded in the scene.

    Xenko scripts are written in C#. You can edit scripts in Game Studio or another IDE (such as visual Studio). Scripts are debugged in Visual Studio.

    Scripts

    Note

    Explaining C# is out of the scope of this documentation.

    Scripts have access to the IScriptContext, which accesses the main modules of the Xenko engine:

    • Audio: the audio system
    • Content: loads and saves content from assets
    • EffectSystem: loads and compiles effects and shaders
    • Game: accesses all information related to your game
    • GraphicsDevice: low-level graphics device to create GPU resources
    • Input: keyboard, mouse and gamepad states and events
    • Services: a registry of services that you can use to register your own services
    • SceneSystem: the currently displayed scene
    • Script: accesses the script manager to schedule or wait for the termination of scripts
    • SpriteAnimation: animates sprites
    • Log: logs messages and errors from scripts

    You can still use standard C# classes in Xenko, but these aren't called scripts and you can't attach them to entities in Game Studio.

    In this section

    • Types of script
    • Create a script
    • Use a script
    • Public properties and fields
    • Scheduling and priorities
    • Events
    • Debugging
    • Preprocessor variables
    • Create a model from code
    • Improve this Doc

    Back to top

    Copyright © 2016 Silicon Studio
    Generated by DocFX