x

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"

I can not add a material from c ++

Hello!

I can not add a material from c ++

my code..

alt text

alt text

alt text


the static mesh if it is loaded but the material does not


alt text


result:


alt text


the material does not load, what am I doing wrong


Product Version: UE 4.19
Tags:
1.png (31.1 kB)
2.png (67.4 kB)
captura.png (46.8 kB)
captura2.png (312.6 kB)
more ▼

asked Sep 13 '18 at 03:52 AM in C++ Programming

avatar image

danielf94
91 2 8 9

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

1 answer: sort voted first

It's not a Material Instance, it's a Material. So try changing UMaterialInstance to UMaterial.

more ▼

answered Sep 13 '18 at 05:01 AM

avatar image

erikdubbelboer
366 3 4 7

avatar image danielf94 Sep 13 '18 at 06:15 AM

@erikdubbelboer ok friend..

now if you add it in the editor, but when compiling the materials are not reflected

alt text

try creating an instance of the material like this:

alt text

and changing my code like this:

alt text

it does not work, materials are not reflected

alt text

Now I realized that if I change the component from "UInstancedStaticMeshComponent" to "UStaticMeshComponent" if it works, but I need them to be instances. "UInstancedStaticMeshComponent"

avatar image erikdubbelboer Sep 13 '18 at 11:59 AM

Materials have an attribute "Used With InstancedStaticMeshes" You have to toggle that to true in the editor and then it should work.

avatar image danielf94 Sep 13 '18 at 05:37 PM

@erikdubbelboer thank you very much, that was all

(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