Help For Getting Started Code Errors

Hi,
I just begin to work on Unity with babylon.js and I am trying follow the getting started guide.
I copied the code from the Getting Started Video but it is not working for me. Why, someone can i help me about this subject?

Here is the codes:

ts

 /* Babylon Scene Controller Template */
module PROJECT {
    export class SceneController extends BABYLON.MeshComponent {
        public constructor(owner: BABYLON.AbstractMesh, scene: BABYLON.Scene, tick: boolean = true, propertyBag: any = {}) {
            super(owner, scene, tick, propertyBag);
        }

        protected ready() :void {
            // Scene execute when ready
        }

        protected start() :void {
            // Start component function
            let hello:string = this.getProperty("hello","Hello World");
            console.log("Scene Controller Says: " + hello);
        }

        protected update() :void {
            // Update render loop function
        }

        protected after() :void {
            // After render loop function
        }

        protected destroy() :void {
            // Destroy component function
        }
    }
}

cs

/* Babylon Editor Script Component (C# UnityScript) */
using System;
using UnityEditor;
using UnityEngine;
using Unity3D2Babylon;

namespace MyProject
{
	public class SceneController : EditorScriptComponent
	{
        [Header("-Script Properties-")]

        [BabylonProperty]
        public string hello = "Hello World";

		protected SceneController()
		{
			this.babylonClass = "PROJECT.SceneController";
		}
	}
}

And here is the error on chorme console:
babylon.js:16 BJS - [23:42:27]: Unable to load from scenes/SampleScene.babylon: Error in onSuccess callback

Pinging @MackeyK24

That could really anything… try without any scripts attached to node… see if you can just export the geometry first…

If you like, package up the scene and send it to me… I’ll see if I can see anything

Thank you for your reply.
I uploaded the unity project. If you can check it, I will be grateful for.


Thanks in advance.

Your Scene is fine… You forgot to enable typescript and click detect compiler location button to setup where you have typescript installed… If you dont have typescript installed:

npm install -g typescript

Please watch the whole getting started video: https://www.babylontoolkit.com/videos/GettingStarted.mp4

It has details to get your started :slight_smile:

1 Like