⚡ Prop Injection System

ScriptComponent now supports automatic prop injection.

You can directly pass references and values — no manual lookup needed.

🔗 Setup

js
import { ref } from "kernelplay-js";

player.addComponent("playerController", new PlayerController({
  enemy: ref(5),
  force: 800,
  camera1: ref(100),
  camera2: ref(101),
}));

🚀 Usage

js
// Use injected values directly
if (Keyboard.isPressed(KeyCode.ArrowRight)) {
  rb.addForce(this.force, 0);
}

// Switch camera
this.setPrimaryCamera(this.camera2);

// Destroy referenced entity
this.enemy.destroy();

// Change camera target
this.camera2.getComponent("camera").setTarget(this.enemy);