Donspace  
                
                  
                    June 11, 2020,  7:16am
                   
                  1 
               
             
            
              In BallGenerator.cpp I wrote:
But when I compiled it, it showed errors like:
C2338	The given OwningObject is not of a supported type for use with CreateWidget.
C2665	��UUserWidget::CreateWidgetInstance��: 5 ��������û��һ������ת�����в�������
But in other tutorials their codes were just like what I wrote. What OwningObject should I use in CreateWidget?
             
            
              2 Likes 
            
            
           
          
            
              
                k_Rave  
                
                  
                    June 16, 2020,  8:11am
                   
                  2 
               
             
            
              Does BallGenerator derive from UWidget, UWidgetTree, APlayerController, UGameInstance or UWorld ?
As you can see in this screenshot from UserWidget.h, CreateWidget() checks if the owner derives one of these classes.
Also make sure to check the output log to see which class is used as the Owner in CreateWidget().
             
            
              5 Likes 
            
            
           
          
            
              
                microjiao  
              
                  
                    March 14, 2022,  9:40am
                   
                  3 
               
             
            
              Thanks, Its help me~ 
             
            
              
            
           
          
            
            
              You can put GetWorld() instead of this
             
            
              6 Likes 
            
            
           
          
            
              
                rxpel  
              
                  
                    November 21, 2023, 12:12am
                   
                  5 
               
             
            
              This worked for me, thank you very much