Announcement

Collapse
No announcement yet.

Using Microsoft Visual Code to add Assets?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using Microsoft Visual Code to add Assets?

    Hey forum,

    I've been wanting to find a way to load XML data so I've been looking around and came across some useful file system resources like
    https://answers.unrealengine.com/que...blueprint.html
    https://wiki.unrealengine.com/Save_S..._Files#Loading
    https://docs.unrealengine.com/latest...ile/index.html

    And so I created a simple replica of what I saw there, which is this:
    MyBlueprintFunctionLibrary.h
    Code:
    #pragma once
    
    #include "Kismet/BlueprintFunctionLibrary.h"
    #include "MyBlueprintFunctionLibrary.generated.h"
    
    UCLASS()
    class T_FILE_LOAD_API UMyBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
    {
    	GENERATED_BODY()
    		UFUNCTION(BlueprintCallable, Category = "save")
    		static bool FileSaveString(FString SaveTextB, FString FileNameB);
    		
    	UFUNCTION(BlueprintPure, Category = "save")
    		static bool FileLoadString(FString FilenameA, FString& SaveTextA);	
    }
    and
    MyBlueprintFunctionLibrary.cpp
    Code:
    #include "FTL_Overdrive.h"
    #include "MyBlueprintFunctionLibrary.h"
    
    bool UMyBlueprintFunctionLibrary::FileSaveString(FString SaveTextB, FString FileNameB)
    {
    	return FFileHelper::SaveStringToFile(SaveTextB, *(FPaths::GameDir() + FileNameB));
    }
    
    bool UMyBlueprintFunctionLibrary::FileLoadString(FString FileNameA, FString& SaveTextA)
    {
    	return FFileHelper::LoadFileToString(SaveTextA, *(FPaths::GameDir() + FileNameA));
    }
    However, running on Mac OSX, I've been using Microsoft Visual Studio Code as opposed to the regular Visual Studio. The problem with Code is that it doesn't seem to have the same sort of compiler functionality as Visual Studio has. It has 'build' though. So I run a build task with the .Build.cs file selected and I see some status icon flicker in the bottom-hand status bar, presumably saying "I'm building now".

    But I don't know what it's done at this point. When I open the Unreal Editor, there are no Blueprints to be found by typing in 'save' or 'text' or 'file' that were any different from the ones that came with the Editor. I've tried restarting the Editor too.

    What is it I'm supposed to do to get my C++ code integrated into the Editor as a Blueprint?

    Sorry, total C++ and Unreal coding noob - experienced programmer though so you can throw crazy coding jargon my way without worrying to confuse me. :P

    #2
    How do you normally build code? What is it you're building?

    Do I need to include some Engine assets to get my code integrated?

    Comment


      #3
      Visual Studio Code doesn't ship with a C/C++ compiler toolchain. On Mac you'd build your project with XCode, the basics are covered in the Quick Start
      Contact: enlight in #unrealengine IRC channel on Freenode, or @macagonator on Twitter

      Comment


        #4
        Thanks. I've been trying to compile my code in XCode, but have been running into some issues.

        XCode doesn't seem to like my class definitions. Is there any chance you could spot what I've done wrong?
        Click image for larger version

Name:	Screen Shot 2015-09-05 at 11.42.43.png
Views:	1
Size:	246.2 KB
ID:	1087168
        Click image for larger version

Name:	Screen Shot 2015-09-05 at 11.41.44.png
Views:	1
Size:	193.0 KB
ID:	1087169

        Comment


          #5
          1. Your constructor and destructor definitions in the .cpp refer to a MyBlueprintFunctionLibrary, there is no such thing, as per the .h it's supposed to be UMyBlueprintFunctionLibrary. Unless you actually need a constructor/destructor remove them entirely.
          2. T_LOAD_IT_API should probably be FTL_OVERDRIVE_API as that macro is generated from the project name.
          Contact: enlight in #unrealengine IRC channel on Freenode, or @macagonator on Twitter

          Comment


            #6
            Thanks enlight. Whereas the screenshots above don't seem to suggest this, those are both things I already tried. The results are the same.

            But I will remove the constructor and destructor; they were only added there because Unreal put them there as it created the C++ code.


            Any other ideas on what may be amiss here?

            Comment

            Working...
            X