Code Monkey home page Code Monkey logo

Comments (3)

yt09 avatar yt09 commented on May 2, 2024

///


/// 初始化Behavic
///

///
private bool InitBehavic()
{
behaviac.Debug.LogWarning("InitBehavic");

    behaviac.Workspace.Instance.FilePath = ExportedFilePath;
    behaviac.Workspace.Instance.FileFormat = behaviac.Workspace.EFileFormat.EFF_xml;

    return true;
}

private static string ExportedFilePath
{
get
{
string relativePath =
#if UNITY_EDITOR
"/StreamingAssets/BehaviacSpace/Skill/exported";
#elif UNITY_ANDROID
"/StreamingAssets/BehaviacSpace/Skill/exported";

#elif UNITY_STANDALONE
"/StreamingAssets/BehaviacSpace/Skill/exported";
#endif

        if (Application.platform == RuntimePlatform.WindowsEditor)
        {
            return Application.dataPath + relativePath;
        }
        else if (Application.platform == RuntimePlatform.WindowsPlayer)
        {
            return Application.dataPath + relativePath;
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            return "jar:file://" + Application.dataPath + "!/assets/" + relativePath;
        }
        else
        {
            return Application.dataPath + relativePath;
        }
    }
}

from behaviac.

hemingfei avatar hemingfei commented on May 2, 2024

遇到同样的问题。请问如何解决。

from behaviac.

yt09 avatar yt09 commented on May 2, 2024

其实需要把导出的行为树放在resources文件夹下 比如 public static string ExportedFilePath
{
get
{
string relativePath =
#if UNITY_EDITOR
"/Resources/BehaviacSpace/Skill/exported";
#elif UNITY_ANDROID
"/Resources/BehaviacSpace/Skill/exported";
#elif UNITY_IPHONE
"/Resources/BehaviacSpace/Skill/exported";
#elif UNITY_STANDALONE
"/Resources/BehaviacSpace/Skill/exported";
#elif UNITY_WEBGL
"/Resources/BehaviacSpace/Skill/exported";
#endif

        //if (Application.platform == RuntimePlatform.WindowsEditor)
        //{
        //    return Application.dataPath + relativePath;
        //}
        //else if (Application.platform == RuntimePlatform.WindowsPlayer)
        //{
        //    return Application.dataPath + relativePath;
        //}
        //else
        if (Application.platform == RuntimePlatform.Android)
        {
            return "jar:file://" + Application.dataPath + "!/assets/" + relativePath;
            //return "Assets" + relativePath;//能攻击 Resources 前地址没用
        }
        else if (Application.platform == RuntimePlatform.WebGLPlayer)
        {
            //  LogWrapper.LogInfo("webgl路径:" + Application.dataPath + "/Release" + relativePath);
            return Application.dataPath + "/Release" + relativePath;
        }
        else
        {
            //   LogWrapper.LogInfo("路径:" + Application.dataPath + relativePath);

            return Application.dataPath + relativePath;
        }
    }
}

from behaviac.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.