Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Declaring a vector variable

I want to pass a variable to the FColor(r,g,b,a) function.

Something like this:

 FVector4 MyColor = FVector4(150,150,150,50);
 GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor(MyColor), TEXT("Hello."));

Which does not work. What is the proper way to declare MyColor?


For anyone wondering, through the guidance of the answer below I got it to work as I want it with:

         FColor MyColor = FColor(150,150,150,50);
         GEngine->AddOnScreenDebugMessage(-1, 5.0f, MyColor, TEXT("Hello."));

(The 150.0/255.0 normalization is not needed since the function wants a value between 0 and 255.)

Product Version: Not Selected
more ▼

asked Jul 19 '14 at 11:37 PM in C++ Programming

avatar image

36 3 6 13

avatar image Dieselhead Jul 21 '14 at 09:13 AM

If it's important you can create an FLinearColor which stores floats, and use it to get an FColor from those values. You can also create FVector4s from FLinearColor and vice versa.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first
 FColor MyColor = FColor(150.0/255.0, 150.0/255.0, 150.0/255.0, 50.0/255.0);
more ▼

answered Jul 19 '14 at 11:45 PM

avatar image

880 46 44 80

avatar image mattis Jul 19 '14 at 11:48 PM

Thank you!

avatar image mattis Jul 20 '14 at 09:05 AM

Even though the 150.0/255.0 normalization doesn't work here, it wants a value between 0 and 255.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question