Closed Battlehub0x closed 7 months ago
Using code:
using Battlehub.RTCommon;
using Battlehub.RTEditor;
using Battlehub.RTSL.Interface;
using UnityEngine;
[DefaultExecutionOrder(-95)]
public class SetRootPath : EditorExtension
{
protected override void OnInit()
{
var projectAsync = IOC.Resolve<IProjectAsync>();
projectAsync.Safe.SetRootPathAsync("C:/Dev/Data/");
}
}
Using settings:
Here's how to load the scene after opening the project at the specified path:
using Battlehub.RTCommon;
using Battlehub.RTEditor;
using Battlehub.RTSL.Interface;
using UnityEngine.SceneManagement;
public class LoadScene : EditorExtension
{
private IProjectAsync m_projectAsync;
protected override void OnInit()
{
base.OnInit();
m_projectAsync = IOC.Resolve<IProjectAsync>();
m_projectAsync.Events.OpenProjectCompleted += OnOpenProjectCompleted;
}
protected override void OnCleanup()
{
base.OnCleanup();
m_projectAsync.Events.OpenProjectCompleted -= OnOpenProjectCompleted;
m_projectAsync = null;
}
private async void OnOpenProjectCompleted(object sender, ProjectEventArgs<ProjectInfo> e)
{
await m_projectAsync.LoadAsync("scene123", typeof(Scene));
}
}
Hi, Feature request: Rather than use Application.persistentDataPath for project data, could you have a setting for this? I need to store my data elsewhere so it is include in git. I implemented this in the last version I had, but it of course got stomped when I updated.