Nurglini
Nurglini
CC#
Created by Nurglini on 10/16/2024 in #help
[Unity] Is there a way to have a ContextMenu give an arguement to a method?
I'm working on a real simple save function in Unity that I can call from the context menu, and everything works wonderfully without an input (of where to save) so far, but I'd like to be able to test it with different save locations. That's all context though, my question is can I pass an input into the method being called through the Context Menu? https://discussions.unity.com/t/can-contextmenu-pass-arguments-into-a-method/248683 I found this discussion thread, but it's a few years old and just amounts to "Probably not", so I'm curious if anything has changed.
1 replies
CC#
Created by Nurglini on 9/5/2024 in #help
How do you declare an Array's Count property to be consistent within a Struct?
I'd like to make a struct with one of its variables being an array that's a consistent size, even if not all data points within that array are filled.
public struct Location
{
public string ID { get; set; }
public float[] Values { get; set; }
}
public struct Location
{
public string ID { get; set; }
public float[] Values { get; set; }
}
I would like my Values[]'s count property to be consistent, but I can't find a way to set that within the struct (say, all Locations will have an array of 10 Values). How could I do that?
16 replies
CC#
Created by Nurglini on 12/19/2023 in #help
Visual Studio not recognizing Windows assembly references or namespaces
I continually run into issues with Visual Studio not recognizing .NET namespaces I just tried to reference System.Windows.Input.MouseButtonState, since MouseEventArgs' Windows.Forms wasn't recognized, but that also is missing an assembly reference. Do I need to install something onto VS, or do something else, or do these all happen to just be deprecated or something?
2 replies
CC#
Created by Nurglini on 11/24/2023 in #help
Can you store a unique function within a class?
I'm new to working with classes in C# and would like to be able to use them for a game I'm working on - seems very integral to coding efficiently. public class Entity { public string Name { get; set; } public int Health { get; set; } public List<Ability> Abilities { get; set; } } public class Ability { public string Name; public string Description; public void Effect() { } } Ability Fireball = new Ability() { Name = "Fireball", Description = "A ball of fire."}; This is my current code, and I'd like to be able to allocate predefined abilities/actions to the individual entities, but when I try to define 'Fireball' in this example, I can't set what it's effect is? I imagine it's because the way I have it written currently, the effect would be constant within the class of Ability, rather than being a function I can assign to each one. Is there a way I can do this, or an alternative method to achieve this? What I'm currently working towards is being able to write my code as if it were Entity.Abilities[0].Effect(); or something similar.
7 replies
CC#
Created by Nurglini on 10/25/2023 in #help
Is there a 'foreach' equivalent for parts of a class?
I have a class (Stored) defined that has strings stored (Name, ID, and Data, then some others I havent settled on a name for). Many of these are going to be integers stored as strings and would like to be able to go down each element whenever a Stored object is inputted and format them in a certain way if they are actually a number. I'm not familiar with how foreach works but from what I've read it can't be used for classes - is there an equivalent I can use to accomplish this?
48 replies
CC#
Created by Nurglini on 7/3/2023 in #help
❔ Live USB/Wireless Video Access Help
Hi there! I'm trying to learn how to work with Serial Communications or some other method like Bluetooth to access data from an external device, but have hit a wall in searching for what methods would allow me to do this. Currently I'd like to try making a program that would function similarly to how Discord is able to screen-share mobile devices, but instead directly to its own window on the desktop device it connects to. I'd appreciate recommendations of good resources for learning video transmission in ways such as this, or just general advice for approaching this.
3 replies