Stride

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

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
  • Documentation
  • Manual
  • API
  • Release Notes
  • Tutorials
    Show / Hide Table of Contents
    • 要件
    • Unity® 開発者のための Stride
    • Stride Launcher
    • はじめに
      • Stride のインストール
      • Visual Studio 拡張機能
      • Stride の起動
      • プロジェクトの作成
      • Game Studio
      • アセット
        • アセットの作成
        • アセットの使用
      • シーン
        • シーンの作成
        • エンティティの追加
        • エンティティの管理
        • シーン エディターでの移動
      • ゲームの起動
    • アニメーション
      • アニメーションのインポート
      • アニメーション プロパティ
      • アニメーションのセットアップ
      • アニメーションのプレビュー
      • アニメーション スクリプト
      • 加算アニメーション(Additive Animation)
      • プロシージャル アニメーション
      • カスタム ブレンド ツリー
      • モデル ノード リンク
      • カスタム属性
    • オーディオ
      • オーディオのインポート
      • オーディオ アセット プロパティ
      • 非空間オーディオ
      • 空間オーディオ
        • オーディオ エミッター
        • オーディオ リスナー
        • 頭部伝達関数 (HRTF) オーディオ
      • オーディオのストリーミング
      • グローバル オーディオの設定
      • オーディオ ファイルの範囲再生
      • カスタム オーディオ データ
      • オーディオ デバイスの設定
    • エンジン
      • アセット マネージャー
        • アセット バンドル
        • アセットの制御
      • エンティティ-コンポーネント モデル
        • エンティティの管理
      • ファイル システム
    • ファイルとフォルダー
      • プロジェクトの構造
      • キャッシュされたファイル
      • バージョン管理
      • ゲームの配布
    • Game Studio
      • シーン
        • シーンの作成
        • シーン エディターでの移動
        • シーンの管理
        • シーンのロード
        • エンティティの追加
        • エンティティの管理
      • アセット
        • アセットの作成
        • アセットの管理
        • アセットの使用
        • アーキタイプ
      • プレハブ
        • プレハブの作成
        • プレハブの使用
        • プレハブの編集
        • 入れ子になったプレハブ
        • プレハブ プロパティのオーバーライド
        • プレハブ モデル
      • ゲームの設定
        • スプラッシュ画面
      • ワールド単位
    • グラフィックス
      • カメラ
        • カメラ スロット
        • モデルファイルを使ったカメラのアニメーション
      • マテリアル
        • マテリアル マップ
        • マテリアル 属性
          • ジオメトリ 属性
          • シェーディング 属性
            • サブサーフェス スキャタリング
          • その他の属性
          • クリアコート シェーディング
        • マテリアル レイヤー
        • マテリアル スロット
        • 開発者向けのマテリアル情報
      • テクスチャー
        • 法線マップ
        • テクスチャーの圧縮
        • ストリーミング
        • スカイボックスと背景
      • ライトとシャドウ
        • ライトの追加
        • ポイント ライト
        • アンビエント ライト
        • ディレクショナル ライト
        • スカイボックス ライト
        • スポット ライト
        • ライト プローブ
        • ライト シャフト
        • シャドウ
        • ボクセルコーントレーシング GI
      • ポストエフェクト
        • アンチエイリアシング
        • アンビエント オクルージョン
        • ブルーム
        • 明度フィルター
        • 色変換
          • フィルム グレイン
          • ガンマ補正
          • トーンマップ
          • ヴィネッティング
          • カスタム色変換
        • 被写界深度
        • レンズ フレア
        • ライト ストリーク
        • ローカル反射
      • グラフィックス コンポジター(Graphics Compositor)
        • シーン レンダラー
          • カスタム シーン レンダラー
        • デバッグ レンダラー
        • レンダー テクスチャー
        • レンダーグループとレンダーマスク
      • エフェクトとシェーダー
        • エフェクト言語
        • シェーディング言語
          • シェーダークラス、ミックスイン、継承
          • コンポジション
          • テンプレート
          • シェーダー ステージ入出力の自動管理
          • シェーダー ステージ
        • カスタム シェーダー
        • シェーダーのコンパイル
      • 低レベル API
        • テクスチャーとレンダーテクスチャー
        • パイプライン ステート
        • リソース バインディング
        • 頂点の描画
        • スプライト バッチ
        • スプライト フォント
      • レンダリング パイプライン
        • レンダーの機能
        • レンダー ステージ
      • スプライト フォント
    • 入力
      • ゲームパッド
      • ジェスチャー
      • キーボード
      • マウス
      • ポインター
      • センサー
      • 仮想ボタン
    • ナビゲーション
      • ナビゲーション グループ
      • ナビゲーション メッシュ
      • ナビゲーション境界ボックス
      • ナビゲーション コンポーネント
      • 動的ナビゲーション
    • パーティクル
      • パーティクルの作成
      • エミッター
        • シェイプ
          • リボンと軌跡
        • パーティクル マテリアル
        • パーティクル スポナー
        • パーティクル イニシャライザー
        • パーティクル アップデーター
      • パーティクルのチュートリアル
        • パーティクル マテリアル
        • 継承
        • レーザーと稲光
        • 軌跡の作成
        • カスタム パーティクル
    • 物理特性
      • コライダー
        • 静的コライダー
        • 剛体
        • キネマティック剛体
        • キャラクター
        • コライダーの形状
        • トリガー
        • コンストレイント
      • レイキャスティング
      • シミュレーション
      • 物理演算のチュートリアル
        • 跳ね返るボールの作成
        • スクリプトによるトリガー
    • プラットフォーム
      • Linux
        • セットアップと要件
        • Linux 用ゲームの作成
      • UWP
        • Xbox Live
      • iOS
      • プラットフォームの追加と削除
      • グラフィックス プラットフォームの設定
    • スクリプト
      • スクリプトの種類
      • スクリプトの作成
      • スクリプトの使用
      • パブリック プロパティとフィールド
      • スケジューリングと優先度
      • イベント
      • デバッグ
      • プリプロセッサ変数
      • コードからのモデルの作成
    • スプライト
      • スプライト シートのインポート
      • スプライトの編集
        • スプライトの境界の設定
      • スプライトの使用
    • UI
      • UI ページ
      • UI ライブラリ
      • UI エディター
      • シーンへのUIの追加
      • レイアウト システム
    • ビデオ
      • ビデオのセットアップ
      • ビデオ プロパティ
      • ビデオをスカイボックスとして使用
    • バーチャルリアリティー
      • VR の有効化
      • VR でのシーンのプレビュー
      • オーバーレイ
        • オーバーレイへの UI の表示
      • VR 酔い
    • パッケージング(NuGet)
      • パッケージの使用
      • パッケージの作成
    • 困ったときには
      • ロギング
      • デバッグ テキスト
      • プロファイリング
      • Stride が実行されない
      • 既定値の変更が実行時に無視される
      • ライトが影を落とさない
      • 完全な呼び出し履歴を使用できない
      • エラー: "A SceneCameraRenderer in use has no camera assigned to its [Slot].Make sure a camera is enabled and assigned to the [Slot]"
    • Manual
    • スクリプト
    • スクリプトの使用

    Use a script

    Beginner Programmer

    To use a script, add it to an entity as a component. You can do this in Game Studio or in code. Stride runs scripts when the entity they are attached to loads.

    You can add a single script to as many entities as you need. You can also add multiple scripts to single entities; in this case, Stride creates multiple instances of the script. This means the same script can have different values in its public properties and fields.

    Add a script in Game Studio

    There are three ways to add scripts to entities in Game Studio:

    • drag the script from the asset view to the entity tree
    • drag the script from the asset view to the entity properties
    • add the script in the property grid

    Drag to the entity tree

    This method automatically creates a new entity that contains the script.

    1. In the solution explorer (in the bottom left by default), select the assembly that contains your script. Game Studio shows your script in the asset view.

      Script in asset folder

    2. Drag the script from the asset view to the entity tree.

    Game Studio adds an entity to your scene, with the script as a component on the entity.

    Entity tree

    Drag to the property grid

    1. In the entity tree (on the left by default), or in the scene, select the entity you want to add the script to.

    2. In the solution explorer (in the bottom left by default), select the assembly that contains your script. Game Studio shows your script in the asset view.

      Script in asset folder

    3. Drag the script from the asset view to the property grid.

      Game Studio adds the script to the entity.

    Add the script in the property grid

    1. In the scene editor, select the entity you want to add the script to.

      Select an entity

    2. In the property grid (on the right by default), click Add component and select the script you want to add.

      Add script component

      Game Studio adds the script to the entity.

    Note

    You can customize where scripts appear in the dropdown using the ComponentCategoryAttribute:

    [ComponentCategory("My Startup Scripts")]
    public class SampleStartupScript : StartupScript
    {
       public override void Start()
       {
           // Do some stuff during initialization
       }
    }
    

    Add a script from code

    The code below adds a script to an entity.

    // myEntity is an existing entity in the scene; myAsyncScript is the script you want to add to the entity
    myEntity.Add(new myAsyncScript());
    

    See also

    • Types of script
    • Create a script
    • Public properties and fields
    • Scheduling and priorities
    • Events
    • Debugging
    • Preprocessor variables
    • Improve this Doc
    In This Article
    In This Article
    • Add a script in Game Studio
      • Drag to the entity tree
      • Drag to the property grid
      • Add the script in the property grid
    • Add a script from code
    • See also

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation