I'm trying to follow this article: https://bronsonzgeb.com/index.php/2021/03/20/pseudo-metaballs-with-scriptable-renderer-features-in-unitys-urp/
I've gotten to the end of it and tried to compile but got the following message:
RenderWater.cs(38,30): error CS0115: 'RenderWater.RenderObjectsPass.OnCameraSetup(CommandBuffer, ref RenderingData)': no suitable method found to override
The line in question is:
public override void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
I'm new to URP and so I have likely missed something, but I have not idea what
Edit: Just need to make sure you have "Universal RP" installed in the Package Manager.
Are you inheriting the right class? You need to make sure that you're doing the following instead of inheriting from MonoBehavior.
YourClass : TheClassWithThatMethodInIt
Are you running into a namespace issue? Does VS flag it as missing the method to override as well?
Lots of missing functions are added to the 2020 version you might want to update your unity to the newer one. You can check the unity change log:
https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal#12.1/changelog/CHANGELOG.html
"OnCameraSetup" is added on the 2020
Related
I created a Swift Framework project in Xcode and I'm trying to export a function for Unity to call. I defined the function like this.
#_cdecl("showPaymentForm")
public func showPaymentSheet()-> PKPaymentAuthorizationViewController?{
NSLog("In showPaymentForm - Navtive code.")
return ApplePayLib.showPaymentSheet(label: "something", total: 9.99, mainViewController: nil)
I ran
nm -gU
against the binary and it doesn't show any functions exported called showPaymentForm. I check the "Symbols Hidden by Default" to make sure it was set to "No".
If I do the same as above in a package instead of a framework, it works fine. I didn't stick with the package project because I need to include other packages that didn't play nice with it.
Not really sure what else to check.
It turned out the issue was due to the swift file not having a target selected. Once I selected the correct target, the function as exported correctly.
MyHUD.h
UCLASS()
class FPS_API AMyHUD : public AHUD
{
GENERATED_BODY()
UPROPERTY(EditDefaultsOnly, Category = Gameplay)
class UUserWidget* DefaultWidget;
...
}
I make Blueprint BP_MyHUD extends MyHUD and Widget Blueprint. The problem is, the DefaultWidget in BP_MyHUD is set None after i restart UE4 program or compile using button in toolbar at Blueprint editor. How can i fix the value of DefaultWidget in BP_MyHUD?
By default variables are set to "Private" and thus can't be modified in derived classes.
Try putting this UPROPERTY after you say public: (you could also use protected:)
UCLASS()
class FPS_API AMyHUD : public AHUD
{
GENERATED_BODY()
public:
UPROPERTY(EditDefaultsOnly, Category = Gameplay)
class UUserWidget* DefaultWidget;
...
}
Also I am unsure of the EditDefaultsOnly specifier when it comes to blueprints. My understanding was without
BlueprintReadWrite
You could not edit the variables in blueprints. But if you've been using this with success with other variables it is likely not the problem.
A bit late to the party, but here's the answer:
It's not possible.
Non-BindWidget pointers with EditDefaultsOnly indeed generate a selector in the Details panel, but this selector is not meant to select a widget inside our component's archetype. It's meant to select a widget outside an instance of our component (it also need to be public and maybe a BlueprintReadWrite too). In this case, the value you put in the selector indeed stay across builds.
Sadly, this error-inducing selector appearing anyway means that two things aren't quite working properly around this behaviour :
At the moment UE clears the selector when you're building, it should really display a warning/error explaining why
You shouldn't really be able to put EditAnywhere/EditDefaultsOnly on a non-BindWidget property, only a EditInstanceOnly... yet there's no warning/error either =(
(credits to #Bohdon Sayre from BenUI's discord community for helping me on this one)
Quick question: I've been using autofac with asp.net core in a project and I've noticed that it tries to resolve all types during configuration after updating it to the latest nuget package (going from Autofac.Extensions.DependencyInjection 5.0.1 to 7.0.2). Btw, here's the code that was being used to register the types:
builder.RegisterAssemblyTypes(typeof(Utilizador).Assembly)
.AsImplementedInterfaces()
.AsSelf();
Until now, I wasn't seeing this behavior. The problem with this new approach is that it will try to resolve types that will never be injected through DI. For instance, it complains about public classes that don't have public constructors event though those classes will never be created through DI.
Can someone point me to when this change happened?
Does this mean that now I must filter the types I need explicitly?
Thanks.
This is nothing new.
You can filter those out with something like below:
builder.RegisterAssemblyTypes(ThisAssembly)
.Where(type => type.GetConstructors(BindingFlags.Public).Any())
.AsImplementedInterfaces();
In MVC 2 I am working on something and have ran into a snag. I got my repository put instead of putting in the same class the interface is I have it same project as the EDMX file.
Initializing StructureMap is what's killing me at this point. Here's where I'm initizing StructureMap (in Global.asax.cs.)
ObjectFactory.Initialize(x =>
{
x.ForRequestedType<IUnitOfWorkFactory>()
.TheDefaultIsConcreteType<EFUnitOfWorkFactory>()
.CacheBy(InstanceScope.HttpContext);
x.ForRequestedType(typeof(IRepository<>))
.CacheBy(InstanceScope.HttpContext)
.TheDefaultIsConcreteType(typeof(GenericRepository<>));
});
The Namespace for this project is GpdsCreationTaxidermy.Data (which is the same Namespace as my GenericRepository.cs). I would post the code for this file but I dont believe that is the problem here. In my Global.asax I import the proper Namespace
using GodsCreationTaxidermy.Data;
The error I'm getting is:
Error 3 The type or namespace name
'GenericRepository' could not be found
(are you missing a using directive or
an assembly reference?)
Also attached is an image showing this particular projects layout
Can someone help with this issue, or what I'm doing wrong here
EDIT I have even tried adding GodsCreationTaxidermy.Data to the file name and still no luck.
Thanks for sending the files :-)
It looks like the definition of GodsCreationTaxidermy.Data has changed.
This is what I did to fix the problem:
Remove these references from GodsCreationTaxidermy.Data.Repository Class Library:
GodsCreationTaxidermy.Data
GodsCreationTaxidermy.Data.Repository
Remove these references from GodsCreationTaxidermy.Data Class Library:
GodsCreationTaxidermy
GodsCreationTaxidermy.Data
Remove the reference to GodsCreationTaxidermy.Data in the GodsCreationTaxidermy MVC project and re-add the reference, choosing GodsCreationTaxidermy.Data from the Project tab
Hopefully that'll get the GenericRepository working :-)
I did notice that the following line no longer works though:
EFUnitOfWorkFactory.SetObjectContext(() => new GodsCreationTaxidermyEntities());
GodsCreationTaxidermyEntities doesn't seem to exist in GodsCreationTaxidermy.Data any more. Does that cause you an issue?
Try this:
.TheDefaultIsConcreteType(typeof(GodsCreationTaxidermy.Data.GenericRepository<>));
Possibly remove <> after GenericRepository. Has GodsCreationTaxidermy.Data been added to the MVC site as a reference?
I've been going through the documentation for creating Prism applications and setting up the Shell seems to be split into 2 methods, CreateShell() and InitializeShell()
For CreateShell I simply have:
protected override DependencyObject CreateShell()
{
return ServiceLocator.Current.GetInstance<Shell>();
}
The documentation says that code is needed in the IntializeShell() method to ensure it is ready to be displayed. The following is given as an example:
protected override void InitializeShell()
{
Application.Current.MainWindow = (Window)this.Shell;
Application.Current.MainWindow.Show();
}
I have noticed however that if I omit the first line and just call the Show() method it seems to work (MainWindow already appears to have Shell assigned to it). Can you tell me why this is the case, and why we still need to explicity set the MainWindow property here?
Also as I did not specifically register Shell to an interface within the container, how is it able to resolve Shell in CreateShell()?
Question 1: Why does just calling Show() seem to work and why is Application.Current.MainWindow seem to be populated?
There are a few things you should check here. In a typical WPF application, the type for the main window can be specified in the App.xaml. If it is specified, WPF will instantiate one of those for you. This is not desirable because WPF won't use your container to instantiate your shell and any dependencies won't be resolved.
When you run that first line of code in InitializeShell, you'd be replacing the WPF-instantiated Shell object with the one you manually instantiated.
I looked at the code for the MEF and Unity bootstrappers and I don't see anywhere that MainWindow is being set, but I don't know if you might have customized the base bootstrappers, so that's something else to look for.
Show() works because you are simply showing the window you instantiated and the WPF-instantiated one isn't shown. This is my theory, but without seeing your code, it'd be tough to say for sure.
Question 2: How can Unity resolve something that hasn't been registered?
Unity can always resolve a concrete type, regardless of registration. It cannot resolve non-concrete classes that haven't been mapped to a concrete type. This is why Resolve<Shell> works, but Resolve<IMyInterface> doesn't unless you register a type.