logo
Main

Forums

Downloads

Unreal-Netiquette

Donate for Oldunreal:
Donate

borderline

Links to our wiki:
Wiki

Walkthrough

Links

Tutorials

Unreal Reference

Usermaps

borderline

Contact us:
Submit News
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic StaticLoadClass() (Read 1158 times)
atrey
New Member
*
Offline


Oldunreal member

Posts: 4
Joined: Nov 7th, 2018
StaticLoadClass()
Dec 24th, 2018 at 12:47am
Print Post  
I have a native function that I am using to play new sound classes:

PlayHatchetSound(class<HatchetSound> sound, optional float newVolume);



In C++, I am using P_GET_OBJECT() to fetch the sound class parameter. I am trying to load that parameter into StaticLoadClass() Like this:

First, I get the parameter using: P_GET_OBJECT(UHatchetSound,ts)

Then I try loading it into StaticLoadClass(), using the String version of the class name:

UObject* objClass = StaticLoadObject(UObject::StaticClass(),NULL,ts.GetName(),NULL,LOAD_NoWarn,NULL)
;




NOW, here is the issue. objClass keeps returning NULL... I can't get this to load at all.


Any help would be appreciated.
  
Back to top
 
IP Logged
 
Smirftsch
Forum Administrator
*****
Offline



Posts: 7923
Location: at home
Joined: Apr 30th, 1998
Gender: Male
Re: StaticLoadClass()
Reply #1 - Dec 25th, 2018 at 9:11am
Print Post  
Guess I need to see more to be able to say something about it. I'm not sure yet what you are trying to do Wink
  

Sometimes you have to lose a fight to win the war.
Back to top
WWWICQ  
IP Logged
 
.:..:
Oldunreal MasterPoster
Developer Team
*
Offline



Posts: 1463
Location: Finland
Joined: Aug 16th, 2005
Gender: Male
Re: StaticLoadClass()
Reply #2 - Dec 27th, 2018 at 8:38am
Print Post  
I'm not sure why you would load class even if its already loaded and passed as an object reference, but for starters you must include package name when loading, not just the name of object.
Code (C++)
Select All
UObject* objClass = StaticLoadObject(UObject::StaticClass(),NULL,ts->GetPathName(),NULL,LOAD_NoWarn,NULL); 



Also do note that if you are aware of the metaclass type, you can use LoadClass macro function instead.
Code (C++)
Select All
UClass* objClass = LoadClass<USound>(NULL,ts->GetPathName(),NULL,LOAD_NoWarn,NULL); 

  

Shivaxi wrote on Jul 25th, 2013 at 12:50pm:
...and now im stuck trying to fix everything you broke for the next 227 release xD Tongue

(ಠ_ಠ)
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint
Bookmarks: del.icio.us Digg Facebook Google Google+ Linked in reddit StumbleUpon Twitter Yahoo