#archived-code-advanced
1 messages · Page 172 of 1
How would I get another application to displaying in unity?
I remember I saw a tool that could do it, but I can not remember what it was called
So today, it's just crashing if I open the Game.exe manually on that system, and I'm not sure how to interpret this Exception Analysis.
Crashing as in you get the Unity crash handler popup?
Yup.
Just as a test it might be worth trying the manual CreateProcessW approach I outlined above
You might not be using IL2CPP, but there might be something else at play here with the implementation of the Process class Unity has
Well no... Right now I mean I'm attempting to open the Game via a double-click. Not via code.
My hunch is that RedirectStandardInput could be related, but we can get to that after knowing whether CreateProcessW crashes or not
I'm confused, which is crashing? The program that was creating the process, or the process it's creating?
The Unity Game.exe is crashing when I initiate it manually.
Where Game.exe is the program being launched by the code above?
Yes. However, I'm not even at the point yet where I'm trying to do it via the code. I was only trying to open it manually to get a log file going to see what happens inside Game.exe if its launched.
I was under the impression that the program launching the process was crashing, not the process being launched
No way to know the cause without seeing code related to that game then, nothing in the code above should be the cause in that case
that's not good
have you tried to start with a log?
i know it doesn't work when you double click
focus on the question 🙂
"no"
I was going to, but someone else on the team deleted that build and replaced it. Now it's starting without crashing, but we're back to the StartProcess issue. If you run the Game.exe manually (double-click) it runs fine and the console window for the headless game opens just fine. However, if its run from the code via the Process the application is launched (I know because I can see it in the Task Manager | Background Processes), but the console window doesn't open.
okay
did you try starting the process with -nographics ? what about -batchmode?
the console window won't open
i don't know why you'd expect that
if you can see it in background processes it's running
what command line are you using to start the application? these are the arguments you're passing to Process or whatever
i'm going to tell you a key detail
in just a moment
just try answering the questions first
it sounds like you didn't realize that the console window will not open
is that correct?
The console opens regardless of how the .exe is started on my PC. Only on the remote server does the console not open, and only when started from Process. The application is started from this code snippet.
just a simple yes or no
the console window will not open
if you start it with process
but the process was started
that's why you see it in taskmanager
does that make sense?
just a simple yes or no
otherwise it's too difficult to help you
Yes...
Do you know why the console opens on my PC when it's started via Process?
No... At least not right now it doesn't. lol
okay
so it doesn't matter
the process has been starting
what is your actual issue?
it's okay if the answer is you're not sure
For debugging reasons, is there a way to have the console open (so if the application "hangs" I can see exactly where it happens)?
Ok.
you have to pass the logFile as an argument, and tail it
I guess there's no issue then. I thought there was because it behaved one way on one PC, and a different way on another.
if you just pass -logFile without an argument, it's supposed to write the logfile to standard out
but i think that'll be too much for you
just write to a log file
using the -logFile argument
is that helpful? @hazy epoch
it sounds like you guys have some bad processes. copying exes onto servers... it's bonkers
that you are remote desktopping into
i'm sure this is just for a prototype or whatever which is fine
if you're trying to write a C# application that starts the "right number" of unity servers
you're reinventing something that is really complex to do, and you're going to run into a colossal number of pitfalls
How would one get X unique values within a random range?
Reinventing? How so?
It's a plugin that hooks into Photon's server calls to ~~create ~~ launch a (Unity) game application instance on the server machine to host a match.
on the positive side, i think you'll get something that works for you
server orchestration is hard
if you only want to deal with the problem of starting the right number of windows executables in the right places, you can use Hashicorp Nomad
that's what roblox does
Do you need to pay the hundred dollars to begin the integration with steam and unity?
if you want to start the right versions of the servers, if you want them to be accessible on the internet, etc., you'd have to use kubernetes
i think so
nomad is the thing you are writing right now
or what it will eventually become
if you fixed lal the problems you're dealing with, you'd be writing Kubernetes
i've never used nomad and i wouldn't recommend it
but it solves problems
it's better than trying to do this yourself
Hi!
I have a quick question:
I'm trying to make a system similar to have unity made for the game Kit project they made a few years ago. Something to allow for sending events from one place to an other.
For this i need some unique ID for the entities that can receive and send commands/events to each other. The game we are making is a large open world game so we are going to have many sub scenes that need to be able to reference each other.
Now my plan is/was to make a script that has a UUID and than in Awake register it to a global list (hash map). Now my problem is that we plan on having prefabs of regular setups like doors. (A prefab of a door with the trigger zone that opens it.). When the user would drag this prefab in it would mean that the UUIDs stay the same. This would result in all the doors opening from any of the triggers.
My question is if there is any way to detect in the editor if a prefab was dragged in?
So that i could automatically regen and map the IDs..
You sure? It just defaults to a log in AppData, not stdout, to my knowledge
Game.exe -logfile CONOUT$ might work to get it to do that though
You can. 480 is the test app id.
thanks so much!
Open the console from a cmd or powershell. That way during crashes, your console will not close
In most cases, you should see message printed on screen for unhandled exception or some fatal error
Hey guys, if you want to serialize a normal c# class for the purpose of saving a game and later run a function on deserialization, what is the best way to implement that function? Is ISerializable the way to go?
I originally tried ISerializationCallbackReceiver and OnAfterDeserialize but the function never seems to fire
Best and easiest way is a json file. Convert your class to json string, and then save it as a file.
If you care about secure data, you can add a layer o lf encryption over the process
@tough tulip I could do json, I already wrote the implementation as a byte stream though
I had the impression that the later would be better because it would be more compressed
What's the advantage of json? Better utilities?
You implement ISerializationCallbackReceiver on serializable classes to implement custom logic when an instance of that class is (de)serialized by Unity, but what you're describing sounds like a custom serialization, not using Unity's serializer.
Problem with byte stream is the ordering of byte data.
If you wish to add a new field, for older data to still be compatible, you'll always have to keep that in mind
Okok yeah this is the impression I was starting to get. That is in fact what's happening.
Oh true
Hadn't thought about that
Might be worth considering that fact
Is there a c# level equivalent to this or do people normally just write their own?
If you already have code that is deserializing a specific data type, you can include your custom logic in that code. An interface like ISerializationCallbackReceiver is only useful if you have a generic (de)serializer like Unity's.
That makes sense, thanks guys!
Not sure if this is the right place to ask, but I have a method that accepts a delegate as a parameter, in this case an Action. If that method listens for a UnityEvent that I have set up in the editor, it won't let me send the Action as a parameter by the drop down. I need to send a call back to this method for...reasons. Basically, I need to know what object is invoking the method of the second object so that upon a certain condition being met within that method, the second object can call a method of the first object in the second objects method that was called by the first object in the first place. Wow I hope that made sense
Alternatively, if there is a super simple way to see what objectA called the objectB.MethodB() from within that method, that'd be dope
That's a strange requirement. Could you be more specific about why you need this?
Hmm...
I'm trying to think of how to explain without over explaining and posting a wall of text lol
Basically, there's a class called GameChunk
It contains a collection of Events that are invoked when the corresponding index of DialogBox's collection of "inputs" (more broad than Inputs from Input class) is triggered. So like, the game chunk handles the data and what events come after it's out put, while the dialog box controls what constitutes an input and how output it handled. The chunk has an ID number for what dialog box it get loaded into which is the index of a DiaogBox object tracked by a collection in the game manager singleton. If the ID is -1 it's supposed to be loaded into the the samedialog box that invoked an event to have the first gam chunk call the second. So like, the chunk doesn't care where it goes, it just cares that it gets loaded by the same dialog box. FWIW dialog box is an abstract class and not neccesarily a box for text and an image. It just porcesses output and input in broad terms for this system I'm building
DialogBoxes are monobehaviours and GameChunks are scriptable objects
Could you store the last dialog box that was triggered somewhere and use that if the ID is -1?
I thought maybe, but like... what about having multiple events and dialog boxes all working in tandem?
Are the events invoked asynchronously?
Can an input be triggered before the events corresponding to another input have finished invoking?
Why are you using indices/IDs instead of referencing the DialogBox directly?
Dialog boxes are held by a singleton in an array. That is how the references are held cause it's dynamic and the Chunks are scriptable objects
Ignoring the UnityEvent part of this for a moment, the simplest way to do this is to just pass objectA into objectB.MethodB():
objectB.MethodB( caller );
Thanks, but I don't think that really solves my problem? Maybe I'm over complicating things or too reluctant to go back and change the structure of my class relationships but....
rather than passing a delegate through the unityevent
pass an interface that your calling classes implement
that interface can have a callback function on it
I got a Spline question. Unity's Spline system has knots that have a tangent and a rotation which is used to get the position of the control point (knot.Position + math.rotate(knot.Rotation, knot.TangentOut)).
I am now trying to figure out how to set the tangent and rotation so the control point is at a specific position. I feel like I am close but I just can't quite figure it out.
You could just set the rotation to identity and only calculate the tangent, which just needs to be the desired position subtracted by the knot position.
...ahhaaa, I see thank you. It was one of those cases were I was trying different combinations of different things and never ended up trying setting the tangent without setting the rot (though I thought I had). Oh well, thank you again
So I'm loading everything in the world with a script that loads and unloads assets around the player based on location. I'm using a minimap package from the webstore that requires scans of the scene in editor mode. Can a scene be preloaded with assets via script?
yes
do you have a basic description of how that would be done? i'm trying to find how to do it, but all the results im getting are explaining how to do the opposite of what i want
it's all one scene and there's like 72 modular assets
but they arent in the scene
it's loaded at runtime
👍
@granite viper sorry, i got the terminology wrong. i mean scene view, not editor
same thing
ok
I created a script which loads satellite elevation data and loads it onto a quadsphere to replicate the Earth but i want to make it more performant. I get pretty significant frame drops and stuttering when higher resolution data is being loaded and I thought of doing a few things such as the jobs system or multithreading but im just not sure what the best approach is. I'm a hobby programmer so im not too familiar with best practices for this sort of thing.
The current system I made loads data from a 1 degree latitudexlongitude file which stores elevation data for 1arcsecond resolution as a 16bit integer, and stores it in a dictionary with a short[,] array and the coordinate of the current tile. I probably need to do some more debugging but I do know when I trigger the sequence which updates the quadtree and then updates the mesh I get pretty bad stuttering so i need to implement something that can do this better, just not sure where to go. Any ideas? Here is a video of my current setup:
https://youtu.be/szlpD2eeU5E
WIP SRTM (Shuttle Radar Topology Mission) data loading into my quadsphere implementation. Need to work on lag spikes when loading in new areas.
yes, there is a super simple way
static object caller = null;
void ObjectAStuff() {
caller = this;
objectB.MethodB();
caller = null;
}
void MethodB() {
Debug.Log(caller)
}
@small torrent if you expect the calls to be recursive, use a stack
if MethodB can throw errors, use try ... finally
a bajillion things in unity work this way under the hood
granted, i don't understand why MethodB doesnt' take the sender as an argument
Oh, I wasn't able to pass a parameter because of how I was setting it up through the editor window to be invoked and wanted to work around
Hello. I am building a multiplayer game with a dedicated server and I have built the server as a console application. Is there any way to input into it?
Input, as in user input? Then Console.ReadLine
What do I need to be using to do that because I can’t find it anywhere
I want some way to manually restart the server,stop it, end game or something
You just have to put that line in the console app's Main method or anywhere else reachable.
Even other threads. That method returns a string you can do logic on.
I did, it works in the editor player but when I build it it doesn’t work
I have just input.get key down s in update that calls server.stop
There is no concept of editor/builds for .NET console applications
I built it from unity as a dedicated server
In fact, running the app from VS actually runs the executable file
So it just doesn’t recognise any input
Is the app actually a .NET Console Application you created in Visual Studio? I don't get it
unity headless builds dont have input support.
if youre trying to send inputs to your headless build, you can create a pure .NET application, and send commands from that to unity using sockets.
the unity headless should listen to the socket port
this will work but im not sure if there's a better approach
Ah, so it's not a console app
unity headless build is a console app. but not built using ryujit compiler. it uses il2cpp or mono and is built from unity editor, just like other builds
Hi
how do i assign values to gameObjects i'm instantiating in code BEFORE they execute their Start() function?
Put a public function on them (e.g. public void Initialize()) and call it with initial values you want to assign.
Do this immediately after instantiation.
This will have to be a component on the GameObject. So you need to do a GetComponent after instantiation.
will that reliably execute before the start() function or should i just put everything from the start function somewhere else and manually execute afterwards?
Try it and see, it works for me.
alright, thanks a lot 🙂
Someone I look up to has managed to save scripts inside an AssetBundle somehow without them being in the Assembly of the built game for a mod somehow. Does anybody have any idea where I can start with this? It'll make life so much easier for me and it'd be really useful
If they accomplished it I know it's possible at least
You could store the compiled dll in the asset bundle and load it manually, but that still requires a bootstrap plugin to load the asset bundle and Assembly.Load the dll. I don't see any other way to do it, Unity does not load assemblies as part of asset bundle loading.
Never heard of a bootstrap plugin before. Any good resources on it?
I use that term to describe a plugin whose only purpose is to set up something else. Preferably, this would be part of the mod loader that is already loading the asset bundles.
Ohhh
I'm guessing Assembly.Load is a function I can call to literally just load in the Assembly file from the build of my level
And I assume you'd have to do it before instantiating the AssetBundle's contents otherwise it may not loads the scripts or something
Yes and yes
Ok sounds good. I'll look into it. Thanks!
That might be helpful as well, somebody recently posted a unitytip for the same question
Alright one more thing because I can't seem to find much on Assembly.Load. Sorry
I guess it'd work something like this?
using System;
using System.Reflection;
using UnityEngine;
public class SpawnStuffIdk : MonoBehaviour
{
void Start()
{
Assembly.Load();
//Load AssetBundle Here
}
}
But how would I like reference the Assembly? If it was in StreamingAssets because I know you can reference stuff in there like this ```cs
Assetbundle assetbundle = AssetBundle.LoadFromFile(Path.Combine(Application.streamingAssetsPath,"test"));
surely Assembly.Load is just not necessary
StreamingAssets only applies to builds as far as I know. If you rename the .dll to some TextAsset extension (.bytes is usually used for binary data), it can be included in an asset bundle and loaded as a TextAsset and then you can load the binary data like this:
Assembly.Load(textAsset.bytes);
Oh that's so useful
So let me get this straight just so I don't have to be annoying and reply again lol
I mean usually used in Unity. Unity recognizes these extensions as TextAsset:
.txt
.html
.htm
.xml
.bytes
.json
.csv
.yaml
.fnt
https://docs.unity3d.com/Manual/class-TextAsset.html
I build my level and take the Assembly-CSharp.dll out of it and bring it into the non-built project
Then put it on like a GameObject or something but change it from .dll to .bytes
And then I can build the AssetBundle and load it in like that
Well it might be a bit problematic referencing the .dll in assets contained in the same asset bundle. Maybe fine if you load the assembly before attempting to load any specific scene or asset referencing scripts in the assembly.
The .dll/.bytes file would just be an asset somewhere in your Assets folder. You can't put it on a GameObject like a component. You could reference the TextAsset in a script on a GameObject, but there's no reason to if you just label the TextAsset to be included in the asset bundle.
So just load the Assembly in before loading the AssetBundle
Also I never knew you could do this. That's niché
But if the assembly is in the AssetBundle, you can't load the assembly without loading the AssetBundle first.
Ah
I guess I just kind of have to hope it works if I load in the AssetBundle and the Assembly is in it? I'm not sure if I missed something you said but Idk if there's anything else I can do to 100% make sure it works
That's not going to work. That's assuming that Unity will look for assemblies in an asset bundle and try to load them, but it doesn't do that.
I'm only suggesting a way to embed a .dll inside an asset bundle so your mod isn't two separate files. You could also just put them in a .zip and unzip that in your bootstrap plugin.
Ah. I think putting them in a .zip would be the best idea for now. Thanks for your help
i believe you can add assemblies to unity nowadays pretty easily by modifying one or two files inside the player
i'm not sure if on desktop platforms, an il2cpp player can load a mono-built dll... but probably
InputSystem supports fake devices
you can create a new Mouse() and new Keyboard() and queue input events for them
InputSystem already has a way to take input events from one unity application and send them over the network to another application
okay i think the way i wrote is best for you then
in principle you can take the bytes of an assembly and store it in a text asset, then write it out and load it
seems like you're figuring it out
there are assets in the asset store for modding you could use
Kinda. It would be better if I could keep it all in one file but like MentallyStable said I can't exactly load the DLL in first
Or well
The TextAsset
it really depends on what people are trying to do
normal people won't for the most part be writing C# with an editor like a programmer... they will just be copying and pasting scripts
it's better to use a pre-existing mod loader, especially one that has appeared in other popular games
@undone coral Ethan is making their own mod for another game
ah i see
Wait why can I not just load the DLL in first? I'm 101% certain that there's a method to load in something specific from the DLL and not just everything
there is
you can add the DLL file to scriptingassemblies.json
and if it needs to load early, use runtimeinitializeonloads.json in the standalone player build
I'm not exactly sure if that's modding friendly. Also this isn't my own mod. Basically the mod I'm using has AssetBundles used as custom levels for the game so I'm trying to find a way I can make the scripts I put in the AssetBundle work
what do you mean? you can modify the json file, i believe the standalone player will load the dll referenced there
what are you actually trying to do?
So I've built a level in a Unity Project ready to upload to a Discord for people to use with a mod. The level however has to be exported as an AssetBundle which means it won't save the scripts and I'm trying to find a way to save the scripts so I can do a lot more with my level instead of just teleporters and tag triggers
create an assembly definition for your scripts
export a standalone build and the asset bundle
if you'd like your scripts to be available to the target application, add them to the application's scriptingassemblies.json file
does that make sense? just try it
see if it works
i think it will
It would work for me but it wouldn't automatically change for others would it?
I don't actually know anything about that .json file so I could be wrong but I assume it wouldn't
The Unity Manual helps you learn and use the Unity engine. With the Unity engine you can create 2D and 3D games, apps and experiences.
yeah lots of ways to roll this
but you'll sitll have to export the assembly somehow
i am not 100% sure how to do that and the way i'd do it myself is really engineery
Thank you
do you need low latency loading?
there are a lot of pros of an approach that is just a C# function with an image as an argument and a Mesh as a return value
interactive loading of these images would require writing a shader
i have a logical/mathematical question not exactly code
is it possible to get a 10 digit non uniform long number from an int?
i should also be able to get back the int number back from the long number
to shed some context ->
i have an unique user id which starts from 1 and so on. i keep incrementing it with user count.
now i want to show the user some unique ID to their account. i dont want to show them their ID directly so i planned to show them IntToHash(int userId) where IntToHash would return some data of some length
I should also be able to get back userId from another function HashToInt(var someHash);
Yes, ideally I would be to load with no stutter or frame drop
why though
do you actually need that?
I want to be able to transition from surface to orbit seamlessly and the current stutters I am getting are pretty bad, its noticeable when moving my camera and it suddenly jumps because of the time between frames when the loading occured
Why do you not want to show their ID directly? Is there some security concern with revealing that information to the user?
not for security reasons, but for privacy
it is fine if anyone can guess the number, but i dont want anyone and everyone to know the plain number directly
If you need to be able to convert the 10-digit number back to the original number, users will be able to follow the same steps if they know what the steps are. To prevent those steps being reverse engineered, you will have to do this conversion outside the client app, on some server, but you can do it client side if you don't mind that possibility. You can use any encryption method you fancy. To ensure it's always 10 digits, you can add 1,000,000,000 to the int after you hash it. Since uint can't be larger than 4,294,967,295, it will ensure the hashed IDs are always in the range 1,000,000,000-5,294,967,295.
yes this is what i had in my mind. But how to implement the hash function?
is there any hash function which I can use and from which I can also get back the original number?
Pretty sure dots jobs would do the trick. Load them multithreaded and pass an entity as done loading event. Get all that streaming of the main thread.
Hash functions are not usually reversible. What you're looing for is encryption, as that can be decrypted.
But why do you need to reverse it? Surely if you are able to hash it in the first place, you must know what the ID is?
Are users meant to copy this hashed ID and submit it somewhere?
its for leaderboard basically. a user can share their profile to other people via a link. the link will take the clicker to a web page.
the user can also share his id to others. then using that userid, anyone can send friend requests, view profiles, etc
i dont want this to be super tight encryption, but i just dont want people to be able too search a profile directly by their plain userid because then profiles with userid 1 and similar lower values will have high profile views, and get spammed with requests
void RaycastWorldUI()
{
if (Input.GetMouseButtonDown(0))
{
PointerEventData pointerData = new PointerEventData(EventSystem.current);
pointerData.position = Input.mousePosition;
List<RaycastResult> results = new List<RaycastResult>();
EventSystem.current.RaycastAll(pointerData, results);
if (results.Count > 0)
{
//WorldUI is my layer name
if (results[0].gameObject.layer == LayerMask.NameToLayer("WorldUI"))
{
string dbg = "Root Element: {0} \n GrandChild Element: {1}";
Debug.Log(string.Format(dbg, results[results.Count - 1].gameObject.name, results[0].gameObject.name));
Debug.Log("Root Element: "+results[results.Count-1].gameObject.name);
Debug.Log("GrandChild Element: "+results[0].gameObject.name);
results.Clear();
}
}
}
}``` I got this code working to return the Button but now , how do i get it to call the standard events like Hover over, and OnClick function for button ?
two packages have copies of System.Runtime.CompilerServices.Unsafe.dll
how can i tell my package of those two to correctly omit its copy when another already exists?
There are actual event listeners you can use, so you don't have to raycast etc. You are basically bypassing the event system this way and not using it
But with what you have, the pointerData tells you the position (hover), press, drag etc as well
Iirc
Are methods decorated with RuntimeInitializeOnLoadMethodAttribute(...) guaranteed to execute in the Unity main thread?
You can assume that of every function unless it's otherwise documented
Once ago, I heard something about that Unity loads scenes in the background, I was wondering if that would affect this methods also or not. Hence the question.
Why are you spamming every single channel in the Discord with off topic stuff
Does anyone know off the top of there head if there is a way to disable certain characters from being inputted into an TMP_InputField? such as disabling Control-I (^i) or ASCII character 9.
anyone have any idea on what is untracked memory exactly in Memory Profiler ? I installed the same APK on 2 different phone, one is showing 36MB for untracked the other one is showing 1GB like the screenshot, i have no clue what is the cause of the difference in untracked memory
this is killing me 😦
Don't crosspost
Untracked memory categories are listed here: https://docs.unity3d.com/Packages/com.unity.memoryprofiler@0.5/manual/index.html#known-limitations
removed other post. I understand what does tracked memory contain but i have no idea why it is so different on different devices
by right the amount of untracked memory should be more or less the same on different android devices
how can I make a random sprite show up when something a bool is true
what is the best function to set a bool isColliding to true while the gameobject with the script is touching another gameobject but set it to false after not touching anymore?
it should be working with multiple gameobject (when going from one to another it should stay isColliding should stay true)
IsTouchingLayer
Not enough information. Also #💻┃code-beginner or #archived-code-general
You can use one of the built in input validators or write your own. Example of a custom validator in this thread https://forum.unity.com/threads/tmp_inputvalidation-documentation.795237/#post-5292597
How can I open and view the default Character Controller script?
component top right, triple points, edit script
guess not then. reference the character controller type in a script temporarily and then click it, and press f12 if using visual studio this should open the script or give you a stub from decompilation
unity decompresses the assets in the background, but everything else i think is main thread
yeah, no. after some search i guess CC is written in native c++. since unity is not open source you can't look at the code
you cannot. but there are many assets that can help you with character controllers
what kind of game is this?
does anyone have experience with the ScriptableRenderFeature api that uses the new RTHandles?
i literally just want a simple blit in urp
you can use a blit material to do that
into the camera
i woudln't overthink it
it won't differ from a performance point of view
i literally just want a simple blit **as a starting point
but all online examples and docs use RenderTargetHandles which are obsolete
Is this the right channel to ask about ml-agents?
why not.
Ok, im looking for some advice. I wanna train an agent to play my puzzle-fighter clone, and I'm wondering if it's feasible to to give the entire gameboard state as an observation, or is that practically too many observations
that's about 168 observations per step I believe
7x12 array with an int and a boolean per cell
i think you can use fewer observations
if they are seperapable into distinct actions, it might be better to split them into multiple agents. otherwise training might take absolutely forever, but you can also try as one and then train the agent on some human play first to get it to an acceptable point
@drifting galleon so you're saying 2 agents working cooperatively could be better?
could be. but i have no idea about your game so, there's only so much i can speculate
I've looked at a few implementations of Tetris AI and they were feeding columns and column heights, but I feel like that won't work for this because in tetris the colors don't actually matter
But in my game they do
if you've already set up the agent, you could try learning on human input first and then check how far you can get
I haven't yet, I've got only a little experience with training AI so I wanted to seek some guidance before I started
But yea, I had considered that
also, if they've observed the columns in tetris, it's kind of a big waste imo. why not just observe the pieces and have a property that describes the shape or identifier of the piece? anyway...
I think the idea behind observing the columns is to represent the state of the board without telling it about every row
that's kinda contrary to how tetris works though. i just think there would've been a better way to do it
Yea I have no idea if it's a good implementation, I just know I haven't seen any examples where the agent observes the entire board state
it really would not even be necessary to observe the whole board. absolutely not. at least not if you have access to the code. if you are standalone and visually observing the board, that's of course massively different
Knowing the colors of the things on the board seems important. I guess I'm just a little lost in how to get started on this lol
just have the color, position and 'shape' / type of piece as a property of the piece and feed that into the agent
for example
Here's an example of puzzle fighter if that helps: https://www.youtube.com/watch?v=K3d97aQiGfQ
Played by: Genbu
All characters played on X' Mode on Normal difficulty.
Losses are edited out except on Akuma fights. -
Disclaimer: Most videos by World of Longplays use SaveStates!
is this for research/academic purposes?
have you tried writing a conventional puzzle fighter bot?
tbh, ai is superior and you don't have to write a conventional bot for ai tom work
Yea I don't see why I would need a conventional bot at all...
If I can get an agent to learn it, that's all I'd need
what gpu do you have anyway?
2070 supa
ok, well that should be kinda ok i think. at least for an ai like this
but then you really don't want 168 observations
I'm having trouble thinking of alternatives
wdym?
1, 2 , 3 observations per piece
Any experienced devs looking for a role in an nft project? 🙂
I'm asking the 30% who are
Oh so instead of observing the board space, give it block vectors and properties? leave out the blanks spaces? I guess that works
nft's are absolutely pointless in gaming
they are absolutely pointless anyway. but especially in gaming
i'm just trying to help you on your goals
Not here to justify anything
you won't be able to write a deep learned agent if you haven't written a conventional one
justify the scam only aspect of nft's?
So I can hack a game, give myself infinite items, and that's okay?
the conventional bot will fix bugs
But NFT backed game won't let that happen
show you what board state matters, etc.
@undone coral Well thanks, I have considered a conventional bot but training an AI agent sounded like a fun project
It might not be a bad idea, but I don't think the bot is necessary to develop the agent, that's all
you will make progress building the conventional bot first
1 - if it's singleplayer only, why not let people cheat?
2 - if you're game is multiplayer you store all that on the server
so you can't cheat
if that doens't appeal to you writing a working agent will not happen
What if your server is down?
Or get's hacked?
then you can't play the game anyway
oof
load a backup
This server needs a no NFT policy
what if the blockchain is down?
You are not going to find anyone here that wants to implement your scam dude
definitely
virtually impossible
If that happens, we are all doomed
And this dev stuff is the least of our worries
also virtually impossible to have all your servers down at once
not really. blockchain is relatively irrelevant in todays time. the only thing affected will be crypto and nft's
yes, devving quality games
you're a comedian
Can you please leave?
in what way?
have you completed the ml-agents tutorial materials?
there is nothing else backed on blockchain atm
it's not like the whole internet will be down when a blockchain goes down
Literally have 25k available for this
@undone coral Yea, I did the ml agents hummingbird project on the learn.unity site
how did that go
25k $?
Obviously not the place for this type of business
$$$
Went great, it's a very well constructed tutorial
you can dev for half a year max with that capital
This is only up front
For a demo
Took me about 5 days to go from zero to training a perfectly competent agent 🙂
There's no job postings here. Use the forums.
so, what's the GAME gonna be anyway?
Not relevant in todays world.
Sorry
And take it to DMs if you all want to debate NFTs.
Thank you
Probably better not to engage with NFT hucksters honestly
That's all I needed
what's the GAME?
Good luck when most of the world will be using NFTs in one way or another 💪
Get lost
lol
i'm interested in what the GAME will be?
You're not my target market
And you are not part of it
i'm still interested in the GAME aspect?
Ok so now I have another question. If I just observe the individual block locations and relevant properties, that means that the number of observations changes as the board gets full. Is that a problem?
ok, from your communication here alone i can be confident that your only ambition is to make it a scam project
Just block him
Let it go bro
i don't block people
🤷♂️
what? you're not telling anyone what the game will be like
Why should I? It's private information. For devs only.
You said it's not relevant. Please stop asking me
Next one of you to continue this is getting muted.
Everyone having a good day?
omg relax. what is problematic here? literally just making fun of scammers
I think the venue is the problem
!mute 215504142947319808 1d Don't waste my time.
Mindstyler#7405 was muted
😦
Also, is this a good server to connect with 3D modelers?
You've already been told the forums are used for job posts. Use them, or find somewhere else.
In general, is there any issue with the number of agent observations being non-constant?
Back-reading this channel was hilarious, I needed that
i think the number of observations have to be constant for a neural network learner
somewhere you'll have to specify a number of observations. unity might have a way to "zero out" observations for you
you're at the start of a very long journey. how seriously do you want to have something that works? @soft hawk
Yes I think you are right
I guess I'll give it a go passing the whole board state and see what happens
Can anyone explain to me how a shader knows what to shade with a blob shadow projector?
I want to use ZTest Always but then multiple blob shadow appear on all objects it intercepts
what is the effect you are trying to achieve?
i want a blob shadow projector always drawn behind objects but if I used ZTest Always in the shader, it draws multiple shadows
I have a drawing app that uses Vectrosity to draw lines. A camera then takes these lines and then converts them to a texture so that more operations can be done on it. It works fine with solid colors, but with semi transparent colors it behaves weirdly.
When I commit the line into a texture, the camera that is looking at the Vectrosity lines takes the image into a render texture and then this is applied onto a Raw Image component. Every time this happens, the alpha value of the texture reduces until the semi transparent part doesn't exist anymore. This doesn't happen with fully transparent colors(you can't see anything anyways), or fully opaque colors.
It goes from this
to this
and eventually this
the render texture is displayed using a raw image component with no material on it
is your color space linear and your render texture graphic format a sensible one?
i have tried on linear and gamma space, with the same results
I have also tried different graphic format for the render texture too
it is usually kept at RGBA32
are you clearing the render texture
before you draw to it again
looks like you're writing to it without clearing
hmm, that could be possible, let me try that out
no luck with that either
What would the equivalent of UnityObjectToClipPos(); be for light sources instead of the camera?
really puzzling then
If I have a class X and an array or list of said X. How would I make X aware of the array or list it is in and what index it occupies?
use a property on the object. implement your own IList<X>
Could you elaborate or point me where to look? I am not 100% familiar with some of this stuff
@sour bay what are you trying to do?
So, I have a game with a grid system
Two types of objects to rest on the grid
Fixed and loose
Loose objects are the focus here
Now, each cell has one spot for a loose object
a person may have a couple spots for a loose object
now, in code, that wold be an array/list of loose objcects
so, if an inventory has 0, 1, 2, 3 spaces
0 = wood
1 = empty
2 = empty
3 = sword
hold on
i think i figuredd it out
rubber duck philosophy?
Just curious what methods do other devs use for implementing terminal velocity on a rigidbody? I am currently using AddForce to control my rigidbody and have tried adding terminal velocity through multiple methods but none have worked.
I have tried
- Setting velocity directly
- Applying an opposite force
- Adjusting drag based on speed
Despite which method I use, I seem to get different current speeds (rb.velocity.magnitude) based on the acceleration I am using.
I'm encountering some problems after calling SceneManager.UnloadSceneAsync
Does some GameObjects in the scene still run Update() and should I add a check e.g. bool sceneUnloading to prevent code running while the scene unloads?
This happens intermittently.
I'm going to implement the boolean check and see if the problem goes away.
I think you have the wrong concept of terminal velocity.
Terminal velocity is used for a free fall, where the drag force balances the force due to gravity, achieving 0 net external force, making the net acceleration 0, hence constant speed.
If you AddForce, you're changing the balance
If you're looking to clamp velocity, the easiest way is to handle the force addition yourself by calculating the instantaneous velocity each fixed update based on acceleration and drag, and applying it
Hey, is there a way to check if a Gameobjects whole underside (eg. of a cube) is touching the another gameobject (eg. a floor)?
There is no job advertising on this discord. See #📖┃code-of-conduct for links to the forums.
Sample several specific points to approximate it
Hey! How can I call a script in a scene, from another scene?
if you have reference to that script then why not?
You can get the reference by using static variable/functions to to store and retrieve the reference, or using Unity's methods like FindObjectOfType. I personally never use FindObjectOfType or similar methods which iterate over entire scene objects
Hey, I need some help implementing a serializable dictionary and its methods to break them down into lists for serialization.
Here is the SerializableDictionary class I am using
https://pastebin.com/4NX1bvjn
and here is the constructor class for my SaveData (incomplete as I do not know how to use the OnBeforeSerialize properly)
https://pastebin.com/qExWu3iz
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
What would the equivalent of UnityObjectToClipPos(); be for light sources instead of the camera?
OnBeforeSerialize simply breaks down the dictionary into generic lists of TKey and TValue.... but it stores them in private variables, and the methods dont return anything, so I have no idea how to access these lists... furthermore, without extending my class to Dictionary, I cant use the type TKey or TValue, and those cant be converted directly to a list with an explicit type
I can solve the latter issue by just doing a for loop on worldFlags.keys and adding them to my List<int>
but this only works if I change the List<TKey/TValue> in the serializeabledictionry class to public, and I dont think thats the intended way of using this
it seems this serializable dictionary uses the ISerializeCallback interface to implement the serialization functionality, but thats kind of over my head
I dont know how to implement that
could really use some assistance
That depends on the light source type. For directional lights it would be an orthographic projection, for spotlights it would be a perspective projection. Point lights are more complicated.
How difficult would it be to make it compatible with all lights?
All directional ones at least
You're talking about for rendering shadow maps, right?
The opposite, surface reflections
hey, I'm trying to add google play games services to our app, I configured both the Unity side of things and Google Cloud/Google Console. I'm getting a "UISignInRequired" as the status code when i try to authenticate the login.
what are the known problems that lead to this ?
I also added the emails to the testing section
https://youtu.be/gtUQjJXICpI trying to recreate the reflection effect this has
Angel Aura Quartz is a beautiful type of crystal coated in precious metals, such as platinum, nickel, gold and titanium. It is then heated in a kiln to facilitate this alchemical process. The holographic tint is due to this alchemical manipulation of a regular quartz crystal.
Angel Aura Quartz works on all chakras due to the rainbow effect
Sh...
This seems more #archived-shaders related
Yeah I suppose it is lol
Do you know much about that topic then?
I'm still struggling with this serializable dictionary, can someone help?
it seems to seralize just fine, but on attempting to load the file, I get a huge error
You'll find more people with knowledge of that topic in that channel, so I'd ask your question there. Include the video to show what you want, because I don't see how UnityObjectToClipPos is going to help you achieve it.
SerializationException: The constructor to deserialize an object of type 'SerializableDictionary`2[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' was not found.
from this line
SaveData data = formatter.Deserialize(stream) as SaveData;```
Someone yesterday typed up some code that does the reflection effect I'm looking for but with a fresnel effect instead of in reference to any actual light
Trying to figure out how to make it so that it does work with light
Ask in #archived-shaders.
Yeah I was trying to avoid that... the thing is I want to have spawn points but everything stays the same except that, which is a different scene (with spawn points). So I don't see a way around this unless the spawn points remain the same across different maps/backgrounds.
Maybe big prefab instead of scene? Would that work? Any caveats?
EDIT: Seems like that wont be async so additive scene is probably the way... unless there's another option.
EDIT2: I think FindGameObjectsWithTag is the more perfomant way to do this.
do I need to just serialize each serializableDictionary to its own file? am I running into this problem because I'm deserializing a SavaData instead of a SerializableDictionary?
Can someone pls help me in #🖱️┃input-system ?
What's faster: FindGameObjectsWithTag or FindComponentsInChildren?
depends on how many objects are in the scene, how many have that tag, how many are in the tree for the root of the FindInChildren, etc.
Doesn't matter. Speed isn't the reason to why you pick 1 or 2. They're basically used for 2 different purposes
Alright, wont worry about it too much then. It's already much better than Find, thanks!
binary formatter is bad
use JSONUtility and reorganize the fields of the scriptable object into a [Serializable] class field
ToJSON and FromJSON<T> that field
are you following the documentation for how to test in editor?
unity has drag
before fixed update, it applies velocity = velocity * ( 1 - deltaTime * drag);
I was trying to do mesh manipulation. Is there any way we can get vertices of bottom face of a cube? (Just that 4 vertices)
theres some bit in the middle thats relevant
Can someone please help I made a cutscene system that works in strange ways but I can't seem to fix it
My Weird Cutscene System
Hey, I'm looking for some architectural advice and/or personal opinions how you'd approach this thing! Let me make a thread before putting the question, it's a terribly long text
Can anyone point me to some resources on how to best encode custom level editor data? Aside from normal game data, I want to have a bool check if the player has actually solved the level themselves. Now if I'm merely using the default JSON, players could of course go into the JSON and change the bool from false to true and therefore completely troll other players quite severely. Should I use a custom file? Encode the JSON using a cipher? Has anyone made some experiences here? :)
unless you make them solve the level on a server that you control, they can cheat, the encryption only keeps away casual cheaters, a dedicated one would just modify the value before it gets encrypted.
I got a question, i was thinking to slice meshes as cubes like Voxel models and gonna make a destructible environment from them but i wonder can i apply physics to those slices meshes ? im not talking about fractured models with multiple gameobjects (i mean ofc slicing them will create new gameobjects but its dynamicaly)
you can do whatever you want, the question is, will it run smoothly, and the answer is often: NO if the meshes/objects are generated on the fly and not pooled, especially if they have colliders; YES if you can somehow prewarm/pool the objects.
they must have colliders to collide other physic elements like bombs, bullets etc.
https://assetstore.unity.com/packages/tools/terrain/voxel-generator-162883 in this package trailer at 1:00 showing a destructible objects with dynamically sliced, i almost need same thing if the idea of im asking about works like this
http://fraktalia.org/wp-content/uploads/2020/02/VoxelGenerator.pdf In here at 4th page he explains how it works on asset also
Guys do you think is it possible to make bot that plays flappy bird on its own?
So you're checking whether all the chars of the string are digits
What does a sample string look like?
"PT_Medieval_Female_Armor_01_A_body"
this is the string
but the number could be also at the end of the string
I could parse each character... but it's boring 😂
Could use some regex for that
I should learn it ... 😅
It'll also handle the case where there are more or less than 1 number inside of it
Regex is the only solution if the string varies greatly
that was my fear
Here you could split by _ if you're 100% sure the number will always be alone, between two _
Or before, or after _ if it's at the start/end of the string
If it's not though, example Some1234Number, you need regex
some assets have the number at the end some other in the middle... artists ¯_(ツ)_/¯
ok I'll go with RegEx
The position isn't a problem, it's what's surrounding the number
you'll never know xD
I personally recommend https://regex101.com to try out regex. It has integrated docs, live explanations and even code generators
oh god, regex ☠️
int number = -1;
string tempStr = new string(text.Where(char.IsDigit).ToArray());
int.TryParse(tempStr, out number);
if(number > -1)
return number;
else
return -1;
Linq FTW 😄
just now... 'cause I couldn't find a way, until now xD
Note that your LINQ solution will concat all numbers, so if you feed in Test_12_string_34, you'll get 1234, which may not be what you want
rayfire works well for dynamic destruction. there's also an nvidia gpu accelerated solution
how can i learn it, i mean is there any source i can check
Regex regex = new(@"\d+");
foreach (Match m in regex.Matches("ac12_34aaa5"))
{
int number = int.Parse(m.Value);
}
As simple as that. Add number to a list or something
Nice 🙂
Idk if this is a #archived-code-advanced problem, but all the other channels are taken up...
I want to mirror all gameobjects within a trigger that are on a specific layer to another area
I am making a yugioh style board
So every object of layer "cards" inside here should scale and be placed on the larger board
I'm not sure the best way to go about it though
Should I instantiate gameobjects, or do something with the rendering
i don't remember the name of the gpu accelerated one but it's an asset
there's great stuff in the asset store for destructible environments, you'll learn a lot from them
@undone coral I was thinking about what you said about creating a conventional AI before training an agent, I get what you meant now
A conventional AI could instruct the agent
But then if I'm going to do that there's barely a need for the agent at all, I might as well just do the pathfinding algorithm too
guys how do you stop the VideoPlayer thing from instantly blinking on when you hit play Its like, as soon as I call Play, it just suddenly appears, not like you have an image you can fade in and out
You could set up a camera that looks down on your "board" rendering to a render texture and then draw it on the other side.
Kinda depends on what your needs are when it's visible on the other side. If you want to be able to also interact you need some more complex setup with duplicated game objects.
Hmm, thanks for the advice, I’ll look into that.
And I really only need it to be visible from the other side, nothing fancy
Although, I assume that would make it a flat 2D texture on the big board
Yeah that would be an issue
If you can get away with duplicate objects I would probably suggest you doing that. This is kind of a hard problem to solve
I have a math question.
I have 2 Vector3's that have magnitudes 3 and 5. If I add these two vector3's, would the magnitude of the sum equal 8?
only if they are pointing in precisely the same direction
Yeah makes sense
otherwise you're forming a triangle and calculating the length of the third side
Thank you
i want you to thrive. writing the bot is part of the journey
Does anyone have a strategy for selecting assemblies at build time? I've split out the logic I use for Steamworks into separate components that each conform to an interface (Lobby, Player Info, event handlers, etc) so that I can do the same thing for Epic Online Services without having to change my core application - plugins, basically. What I'd like to do is 1) not include Steamworks code in the Epic build and visa-versa, and 2) select which assembly definition to include with a command line parameter so I can automate the builds. Does Unity have any tools that can make this easier for me? Does anyone have a better way of switching platform specific components?
How to update y component of a vertex? can we do something like this?
mesh.vertices[i].y = value;
I tried it and not working
Vector3 v = mesh.vertices[i];
v.y = value;
mesh.vertices[i] = v;```
also you really don't want to be doing mesh.vertices in a loop
It creates an entirely new array copying all the vertices into it every time you call that
you should do:
Vector3[] vertices = mesh.vertices;
for (int i = 0; i < vertices.Length; i++) {
Vector3 v = vertices[i];
v.y = value;
vertices[i] = v;
}
mesh.vertices = vertices;```
Thanks a lot
Hey, I've got some kind of riddle for you 🤔 🤣
I have following base classes
public abstract class CommandArgumentParser
{
public abstract bool CanParse(string text);
}
public abstract class CommandArgumentParser<T> : CommandArgumentParser
{
public abstract T Value { get; }
}
with concrete implementations like
public class StringCommandArgumentParser : CommandArgumentParser<string>
{
public override string Value => m_value;
private string m_value;
public override bool CanParse(string text)
{
m_value = text;
return true;
}
}
I am calling CanParse, and if it returns true, I'm using Value in another spot. There's nothing that could possibly affect Value and it's backing field only ever gets set in that method
I've put a Debug.Log(Value) between m_value = text and return true and it properly logs the value of text as one would expect, however, when accessing Value from another place, after CanParse did run and log, it gives me the default value (in this case, null, but happens for int and other types as well)
Any ideas why that would happen? First guess could be that I'm not properly overwriting Value, will double-check on that, anything else..?
What's the execution order of CanParse versus when you're accessing it from the other place? Also, can you share the code where you access it? How are you getting your reference to StringCommandArgumentParser?
I have a class
class CommandSignature
{
public CommandArgumentParser[] Arguments { get; }
}
Arguments is being assigned in constructor.
I'm accessing like
((StringCommandArgumentParser)someSignature.Arguments[0]).Value.
Even when calling
someSignature.Arguments[0].CanParse(...);
Debug.Log(((StringCommandArgumentParser)Arguments[0]).Value);
I'm getting this problem
Anyways, it's 4:20am here, I'm going to sleep and continue bothering with this later, it's also kinda hard to pull this out of the complete context of my program, it's related to a thread I've made previously today, if you mind checking it out
lol sounds good
I'm concerned that you're casting it to StringCommandArgumentParser. That could potentially allow for a situation where you end up with a reference to the base class, not the implementation.
Is there a way to get a hold of the subclass type without casting?
Might not have anything to do with your specific problem though
I put some Debug.Log while trying to fix the issue, I'm definitely getting a StringCommandArgumentParser when casting, even Arguments[0] is StringCommandArgumentParser is returning true
Okay, good
Oh and I might be missing something obvious, but I'm confused as to how this compiles:
public override bool CanParse(string text)
{
m_value = text;
return true;
}
when the method signature it's overriding has a different return value:
public abstract void CanParse(string text);
Ah sorry, I misspelled! It's ofc not a void
Did edit 😀
Kinda terrible to write on a phone XD
Appreciate your interest, but will definitely sleep now, everyone feel free to DM me when having any ideas
i have a 4096x4096 altas in my android build however it only takes 0,5kb memory from memory profiler, the game behaves normally, anyone got any idea on why this is happening ?
is it actually that size or is it just named that
There are per-platform settings that can change that, along with settings in the quality settings that can scale it too
but that is still an absurdly small size for a texture, so it may just be something else going on
we are not setting override for android platform, still it is very werid
the strange part is, if i use android override and make another build, the memory size returns to normal
no code change, just compression format change only
hope you get some rest lol. For what it's worth, I tested the below classes and it performed as expected. So seems like your code is solid, just something unknown must be touching it. A riddle indeed.
using UnityEngine;
public class TestMono : MonoBehaviour
{
private CommandArgumentParser[] Arguments { get; } = new CommandArgumentParser[] { new StringCommandArgumentParser() };
private void Start()
{
Arguments[0].CanParse("test");
Debug.Log(((StringCommandArgumentParser)Arguments[0]).Value);
}
}
using UnityEngine;
public abstract class CommandArgumentParser
{
public abstract bool CanParse(string text);
}
public abstract class CommandArgumentParser<T> : CommandArgumentParser
{
public abstract T Value { get; }
}
public class StringCommandArgumentParser : CommandArgumentParser<string>
{
public override string Value => m_value;
private string m_value;
public override bool CanParse(string text)
{
m_value = text;
Debug.Log(m_value);
return true;
}
}
How would I apply a rotation relative to another point? So if I rotate point A, point B would also rotate to stay in the same relative position? (Like how rotating a parent gameobject rotates the child GO)
If you're profiling in the editor, it would include everything the editor works with in the session, possibly including cached versions of texture with different compression settings.
Profile the build to get precise data.
those testing were done on android devices not editor
Okay then.🤷♂️
however if i alter graphic api to use openGL es3 by default and make a build to test (before it was vulkan default), all atlas size seems to changed back to normal (which is 16MB)
this is really werid
Profiler/graphics API bug?🤔
i guess it might be vulkan has some compression optimization towards sprite atlases ?
coz i use developer option on my android device to check my app RAM usage, the default build (0.5kb atlas RAM) indeed spent less memory than the 2 other control group builds (4mb atlas RAM & 16mb atlas RAM)
hopefully Unity ppl's can jump in to help
you can use commandline.dll
some library that does command line parsing well
and has no dependencies
it's saying that the platform decompressed it into something that shows up in that other part of the memory profiler 🙂
some unity packages do this. but it's okay to just include steamworks and epic code in your thing
i see, that explains the 0.5kb part, but overall still doesnt add up for my case, by right 4096*4096 with unity default compression format should be 16mb in memory. i branched out and updated all my atlas to ASTC 8 Block compression format which uses 4mb in memory only, however the memory usage is still the same as the default compression format
maybe it decompresses to the default format or converts it?
hard to say
maybe on android, on your device, it needs to be a specific format for performance reasons
it happens to be the 16MB one
then converts it
i checked memory profiler and it did get compressed actually
very strange though coz i used SystemInfo.SupportsTextureFormat() to check my deivces supports ASTC or not and it returned false, however memory profiler is telling me it's been compressed
yeah
hmmm
is that the rigth query then?
your game is working and it's ASTC so it must be supported
why would it be wrong? not sure
maybe it returns a cached result and at the time that you call it, vulkan hasn't yet determined if it's supported or something
that would be weird
android can probably convert textures on demand
well Unity doc said it the compression format is not supported it will be decompressed to RGBA 16 or sth, so even thought the format might not be supported the game can still run and play
i kind of feel that memory profiler package is not showing the correct memory usage value, probably like you said it's been decompressed to other part
Not the right channel, but the first step is to log the array lengths and values in Start and in the coroutine
Sorry , i'll delete and anyways it's working i just did forgot to add the child xd
Is there a maximum depth as to how many coroutines are waiting for another coroutine? like "yield return StartCoroutine(Routine);"
I've got an Ienumerator that waits for another Ienumerator in a (unrelated) child class that waits for another Ienumerator in a singleton script but I get this error:
NullReferenceException
The line that it points to is the one inside the Ienumerator in the child class
Also, the child class derives from a class that derives from Monobehaviour but it is not instantiated in the scene
Does anyone know what could be wrong here?
I'm trying to get something (with tag) from an additive scene.
Seems pretty straight forward yet..
that error isn't caused by any kind of limit
Maybe the child class doesn't have access to the coroutine in the singleton script?
Then it would say that
Null reference error means that the value of something is null
So, could it be because the parent class is not instantiated?
Just fixed it actually, I just made the parent class derive from monobehaviour because I couldn't start a coroutine from the child class. But I can reference the target monobehaviour and start the coroutine from it
Thanks for the help though!
I'm using Unity 2019.4. I want to open a second display and have multiple issues. main issue being the screens all open without border (no way to move or resize). I can resize and reposition the second display with d2.SetParams(width, height, 0, 0); but the main display remains in fullscreen and ignores my request to toggle to windowed (I have code that switches between fullscreen and windowed).
Is there a Unity way to get around this? I'm looking into microsoft windows code to change what I want
Need some tips on optimizing a scene with lots of the same object. Separate suggestions are appreciated, although it'd be better if someone can find a full article on this topic.
unity has no exposed concept of a window, display & screen refer to physical displays connected to the host device as reported by the graphics driver, unity's multi-display rendering is aimed at fullscreen rendering over multiple displays.
is it possible to add a public method to unity Button class? I need to assign to buttonA the invoke of onClick of buttonB
Why would you do that?
I wont add the same method on different classes
exteding Button somehow, adding a method that make the button fire would help me a lot
Could you be a bit more concrete about what you're trying to do?
OnSelect event of Textmeshpro input field fire the event of the parent Button
I see that you probably want to invoke whatever clicking Button would do by selecting the textmeshpro part of your UI
yes
I can do it with custom component easily
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Button))]
public class ClickButton : MonoBehaviour
{
private Button _button;
private void Awake()
{
_button = gameObject.GetComponent<Button>();
}
public void _Fire()
{
_button.onClick.Invoke();
}
}
Why wouldn't you just copy the same behaviour of the button-clicking to the text-selecting?
but I wont add the component, but having this method within the Unity Button
bad practice, if I need to change the behaviour I would make the change on 2 different places
Because look, onClick is called onClick for a reason. If you call it when the button isn't being clicked, you might get yourself into trouble at some future point because that's a misuse of the abstraction
Good thinking, then have you considered wrapping that behaviour into some function that's accessible from both places?
I already make it, but I miss the change of the button status (Selected)
Okay. Again it's the same issue: if the button isn't really selected, don't try to make it show as selected. You might eventually find a way to do it, but by doing that you're creating a bug
Ok, I get it
thanks for your feedback, I was underestimate the danger of changing standard behaviour
I've upgraded to a later version of unity, and I'm having some issues with my project files. Apparently they're not being regenerated properly but I can't seem to figure it out.
I do have an external dependency (a shared .net class library that I'm copying to the /Assets/Plugins folder) which has worked for me in the past, but now it appears to be.. not. Compilation in unity works fine, but when I open any of the scripts (in visual studio), the csproj files appear corrupt. Visual Studio is complaining on these lines (in the project file):
<PropertyGroup>
<ProjectTypeGuids>{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<UnityProjectGenerator>Package</UnityProjectGenerator>
<UnityProjectGeneratorVersion>2.0.14</UnityProjectGeneratorVersion>
<UnityProjectType>Game:1</UnityProjectType>
<UnityBuildTarget>StandaloneWindows64:19</UnityBuildTarget>
<UnityVersion>2021.2.14f1</UnityVersion>
</PropertyGroup>
Saying that the project subtype (the one starting in E097...) is missing:
There is a missing project subtype.
Subtype: '{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1}' is unsupported by this installation.
Any ideas?
You're welcome, glad I could help
Uninstalling and then Resinstalling the workload "Game development with Unity" from the visual studio installer fixed it
ok thanks a bunch for that info. guess I am on my own here
Hey guys, i've currently got a dictionary set up with actions, and the action names as strings. is there a way for me to get TryGetValue to give me a reference to the action rather than the action by value?
for a little context
sorry a little confused. You have a Dictionary<string, Action>? And you are asking what exactly?
You want to give an Action and get the string out?
oh I see what you're asking
It's not that you got a by-value
the problem is that action += actually creates an entirely new delegate
you need to do this:
action += obj.function;
BossEventsHandler.actionToString[obj.actionName] = action;```
Sorry i wasn't clear, yeah that's the issue i was trying to address
awesome thank you so much!
shove it back in the dictionary
Will that overwrite all the previous functions that have subscribed to the action?
if so could i do
BossEventsHandler.actionToString[obj.actionName] += action;?
No it won't overwrite all the previous ones
If you want to overwrite the previous ones just use = instead of +=
how would i access a variable in another script that is in a seperate class?
#💻┃code-beginner the most common beginner question in Unity
Is this forum suitable for asking questions regarding to native C++ questions?
if it's unity related, then i guess so
so I have this Firebase authentication script
and I need it to also work in the editor
I want to be able to log into an account from the editor
since I'm making some custom editor windows and tools
It's somewhat Unity related
I wanted to understand how can we pass an std::vector of vertices from a native C++ plugin to C#?
I have been googling regarding the same, however much of the answers pertain to passing arrays from C# to C++, and it's quite unclear how to do the reverse.
The requirement is that I write a simple OBJ loader in C++, which extracts the following data - vertices, triangles, normals and uvs, from an obj model, and transfer that data in Unity, where it will be subsequently supplied to the mesh class.
I can think of two approaches here.
i) implement two functions in unmanaged side. one function to return the length of vector. Using that length you can allocate an array in c# and pass the array to unmanaged code using and fill it there using second function.
ii) easier approach but not be suitable for all applications is by using a c++ cli wrapper
Ayo I have a bit of a problem,
I am continuing someone elses work which was made on unity 2019.3.5
All of the work up until now is done in that version. Part of that was me saving an image of where a player looked at most in a heatmap for which I used a bitmap from System.Drawing (I uncluded the dll using csc.rsp with -r:System.Drawing.dll). Today I tried updating to Unity 2019.4.36 LTS and everything asides from the Bitmap class and Imageformat.bmp works, which I'm stuck on now. Anyone knows how to solve this? https://media.discordapp.net/attachments/811921872467001344/951203329453748284/unknown.png
i have a coding problem, where i cannot hit the a moving target with raycast, in my aim trainer anyone know how to solve this,it is too big to put on here
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
I'm trying to debug some code that run in EditMode, but VS gone crazy and crash when I set some condition on the breackpoint
Shouldn't be so messy 🤔
still crash even with targets[i].name == "PT_Medieval_Female_Armor_hair_01"
I don't think i exists yet on that line
maybe on line 134 it will
but it's just being declared on 133
ok let me test it
I try with just the line below
😂 ok today I learned a new things 🤓
the i didn't exist in the for declaration line
that shouldn't crash VS though. Seems like a bug
Well thing is when a breakpoint hits on a line it's right before that line executes
i isn't declared yet because that line hasn't run yet
🤔 yea that's makes sense.
Regardless, VS shouldn't be crashing from that. Seems like a bug
It should just show you some kind of error
or maybe nothing, but it misbehave sometimes it get frozen
anyway thanks a lot 🙂
the condition are extremely useful when you have a loop with 250 items
Which one is faster for updating a Vector3's value with a translation:
- Changing x, y, z of a Vector3 individually. i.e.
v = new Vector3(v.x + 1, v.y + 2, v.z + 3) - Create a new vector and do addition. i.e.
v += new Vector3(1, 2, 3)
Or is there no significant difference in terms of performance between the two?
the first
although ideally you actually want
v.x += 1;
v.y += 2;
v.z += 3;
though this isn't possible for transform.position and similar since they are properties
first one, second one allocates a new Vector3 and then because of the addition also allocates a new Vector3
It's not about allocations -- the second one is two function calls
both of them aren't allocating anything, they're on the stack
well it still does new twice is what i meant so that's not good
first one is one function call
it actually does it three times, I think
three function calls
anyway, minutia
the important performance consideration here is to minimize the number of function calls you're making
however, with any perf advice -- dont worry about perf early in development unless it's immediately and obviously adversely affecting the experience
Why is that?
I only worry about function calls in very hot path code, like if I'm inside a for loop 10k times
Like why is it not possible to do transform.position.x += 1?
I knew it from the very beginning but never questioned the reason for it

Because transform.position returns a copy of the real backing value
so setting transform.position.x += 1 would be useless and do nothing
I see, thx
Yeah properties are just disguised methods
since this behavior is somewhat unintuitive C# helps you out by throwing a compiler error
And when you return a value type, it makes a copy of it
Okay.. another weird question: Is it possible to vectorize the operations that I want to perform on a bunch of vectors? ("vectorize" as in data science terms)
If you're familiar with numpy or torch you should know what I'm asking
Not familiar either, but is it, like chaining operations on a value and executing it all at once?
Basically I have a bunch of Vector3 in Unity, and I want to apply some operation to all of them. For example, adding (1, 1, 1) to each of them.
In Python, we tend to put these values into 2d arrays and let numpy do an addition with broadcasting, avoiding the use of an explicit for loop, because using a loop is much slower
I'm wondering if the same concept can be applied to Vector3's in Unity
in C#, using a for loop is the fastest way to handle this
Yeah
you could technically add this functionality via linq, or implementing it yourself with an extension method
but again, with all basic perf issues function calls are your enemy
I was about to say, unity burst has this kind of multiplexing for jobs
I'll read it later and let you know if there's anything fun
but you have to use their math library
and I think it may only apply inside jobs? Not sure
you are basically describing a map function. in C# the most direct equivalent would be .Select() (e.g. IEnumerable<int> map = someList.Select(x => x + 1);), multiplexing via vector commands (AVX etc.) and Parallel.ForEach() are advanced variations of the same principle, Burst/Jobs offer some further variations with unity specific optimizations. There is however no immediate reason to avoid C# loops for performance reasons.
There is a thing i dont understand, on OOP Encapsulation is hiding sensitive data from other classes which mean private fields, but Encapsulation also generates public getter/setter methods or properties right. So whats the point of making a variable private but can get or set by public ?
Encapsulation, as i understand it is there just to hide state and internal stuff that is not necessary to see, so that you cannot accidentally go in and directly change it without going through a proper procedure, take something like, a Meter for example cs public class Meter { public int current; public int maximum; } here you can go in and directly change the values, so bugs like current > maximum can happen, this is where encapsulation comes in ```cs
public class Meter
{
private int current;
private int maximum;
public int Current
{
get => current;
set
{
if (value <= maximum) current = value;
}
}
}
so the point of making a variable private but having public get and set is to prevent you from using the data in an illegal way
or something like that
there's definitely more points to it but this is the one i remember
Another nice little thing specifically for getter & setters is that you can plop a breakpoint on them, allowing you to debug whenever a value changes.
when there's only one developer you can change stuff on your own code as you need it, so those decisions don't matter
nothing will stop you from writing buggy code either
if someone else is going to use or contribute code to your game you should document how your code is used via the visibility attributes
compute buffers and compute shaders can help when you want a big performance increase
you can add the library to your assets folder and omit the changes to csc.rsp
unity's plugin api lets you load meshdata from native C++ code i think
you can also construct the Mesh in C++ directly
all Unity.Objects can be constructed in C++
Could you elaborate a bit on it? Thanks a lot
what's your application?
We are creating a game that involves coins. Players will possess a lot of them and we are aware that if there are a lot of them there might be a performance issue - although none of us is experienced enough to tell where exactly the issue lies. Is too many rigid bodies going to be an issue? Or is it fine as long as they don't all have colliders? If the coins need to have different color / textures, will it be more efficient if they all use the same material but I make change to the shader at runtime, than having different materials for each of them, or does it not matter...?
So generally speaking I'm just pretty clueless about which are the most crucial factors when it comes to optimizing a great amount of the same object.
Many of the same with only superficial differences like color are much cheaper than all different things. This is true for everything that needs to be computed.
set up the scene on your target hardware and see what happens
1000x cube rigidbodies + gpu instance material + identical mesh + hdrp sample scene runs at >100fps on my 3090 + 5950
rare but at least i know
professionally you buy the steam hardware survey top items and test on that
Hmm that makes sense

physx is cpu limited
But yeah the point is it should work well on most pcs not mine
lol
lots of factors. shape of the rigidbody's collider is really big
how many are moving at the same time is big

do you even need physics for your coins? Do they even have to be gameobjects? Could they be particles?
Hey, I have a save/load system I've been working on, and I finally got all the bugs worked out of it, tested thoroughly... but when I compile a web build and try to play it in Chrome, it just crashes (grey screens the unity window) in the browser when I try to load a save.... any idea whats going on here?
Heres the code for the save system
https://pastebin.com/sLN0XvYS
Is it just because chrome and other web browsers dont play nice with binary formatters?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
did you try making a development build
I have not, what does that do exactly?
hmm wait I looked up webgl debugging and uh... the first line
Unity WebGL does not have access to your file system
I dont intend for my game to be Web based, I have just been using web builds because its an easy way to let others test and give feedback without having to download anything
but I may just need to bite the bullet and go back to PC windows builds
Yeah, even if you're able to save without errors, that save file won't be available if the user closes the tab, then reopens your game :/
If you want to stick with WebGL builds for testing, you could use Remote Config to save your player's game state as JSON. It's a free service with unity
I just got my save/load system fully working, will I have to make any changes to it to make it work with that?
You would 😦 I mean, not an insane lift but definitely some changes
bleh, I think I've just start doing windows builds
its nearing that point anyways
I plan to have the prototype done by the end of this month, so I dont want to spend a bunch more time on a temporary saving system
Is there a faster way I could perform this operation?
Vector3[] vertices = new Vector3[currentJobData.Vertices.Length / 3];
Vector3[] normals = new Vector3[currentJobData.Normals.Length / 3];
Vector2[] uvs = new Vector2[currentJobData.UVs.Length / 2];
int[] triangles = currentJobData.Triangles.ToArray();
for (int vertex = 0; vertex < vertices.Length; vertex += 3) {
vertices[vertex / 3] = new Vector3(currentJobData.Vertices[vertex], currentJobData.Vertices[vertex+1], currentJobData.Vertices[vertex+2]);
normals[vertex / 3] = new Vector3(currentJobData.Normals[vertex], currentJobData.Normals[vertex+1], currentJobData.Normals[vertex+2]);
}
for (int uv = 0; uv < uvs.Length; uv += 2) {
uvs[uv / 2] = new Vector2(currentJobData.UVs[uv], currentJobData.UVs[uv+1]);
}```
I'm taking mesh data from a job in a nativearray and converting it to proper array. I've reduced it as much as I can but im not sure if it can be optimized more. Depending on the amount of data returned it gets up to ~20ms to execute which causes some noticeable lag spikes
why are you copying element-by-element for verts, normals and uvs instead of ToArray? Your uv indexing looks wrong to me as well
to update the mesh.vertices it needs to be a vector3[] but jobs only support blittable types so i've done everything in float[]
same for uv and normal
Vector3 is a blittable type
same with Vector2. Dump the float shenanigans, you'll save some time there
Really? I tried a few times and kept getting errors
I'll give it another go
Yeah that'd save a massive headache
as far as uv's i havent noticed any issues 🤔 it maps the way I expect it to
it makes more sense to me with your explanation with the floats
Ah okay
This worked much better, thanks
also, make sure you're profiling in a build or with safety checks off. They'll harm performance a lot
Didnt even think of that, i'll do that in the future
for (int i = 0; i < options.Length; i++)
{
options[i].button = options[i].item.GetComponent<Button>();
options[i].image = options[i].item.GetComponent<Image>();
options[i].button.onClick.AddListener(()=>_OnSelect(i));
options[i].image.sprite = options[i].offSprite;
}
When I click on button the integer value passed is options.Length
How to pass the correct value to each option?
for (int i = 0; i < options.Length; i++)
{
int index = i;
options[i].button = options[i].item.GetComponent<Button>();
options[i].image = options[i].item.GetComponent<Image>();
options[i].button.onClick.AddListener(()=>_OnSelect(index));
options[i].image.sprite = options[i].offSprite;
}
it works using a copy variable
There are two admob libs (unified and non unified). I would like to have one implementation for both.
The video ad implementations of both libs are similar. The only problem is OnAdFailedToLoad event. The event returns AdErrorEventArgs in one lib and AdFailedToLoadEventArgs in another event.
I do not want to use preprocessor.
What is your approach?
I have implemented my way below
rewardedAd.OnAdFailedToLoad += (sender, e) => OnAdFailedToLoad(sender, e.To(), adUnitType);
public static class AdErrorEventArgsExtensions
{
public static AdErrorEventArgs To(this AdErrorEventArgs adErrorEventArgs)
{
return adErrorEventArgs;
}
public static AdErrorEventArgs To(this AdFailedToLoadEventArgs adErrorEventArgs)
{
return new AdErrorEventArgs
{
AdError = adErrorEventArgs.LoadAdError,
Message = adErrorEventArgs.LoadAdError.GetMessage()
};
}
}
how to switch between this sprite randomly, so it created illusion like its talking
i tried this
#854851968446365696 and find out how to properly share code.
so you set the sprite to index 2 from the array in Start() and then you never change it again
Use a random number, between 0 and array length (google -> unity how to get random number)
Then change the sprite more often
@craggy spear https://paste.ofcode.org/35LWvzMMX2asYhzpS7NG7aW
i want it to change every 0.5 secs
This really isn't #archived-code-advanced
There are so many ways to do that, and you should use the array length, not hard coding it
If you have issues with that, ask in a more appropriate code channel
you're a beginner though, so #💻┃code-beginner would be the logical place to continue this
Unity has a flipbook package to do this, as for it to be randomized, it's up to your implementation through shadergraph https://github.com/Unity-Technologies/VFXToolbox
that one didnt work either, I tried the one from unity as well as microsoft .net framework
Hey so I was having an issue yesterday with my load game crashing the app in the webGL build, and I thought this was a webGL exclusive problem, since webGL builds dont have access to your file system... but I just made a windows build to test, and it has the same issue... game just crashes on load, and I have no idea how to debug this, or find out why its crashing
look at the logs
I have Firebase set up with my project and I want to be able to log into an account on it inside a custom editor window, out of play mode
how could I do that?
since, the script for that requires a Coroutine as well
having trouble find them. there is no folder for my game in my %TMP% folder
I've looked multiple places it could be
there is an editor coroutines package btw
yup thats the page im on
I've looked where it says they should be
all I can find is a Player.log
at %USERPROFILE%\AppData\LocalLow\CompanyName\ProductName\Player.log
and there doesnt seem to be any useful info in there
interesting note: if I delete my save file, and then try to load a game, it executes these lines, then crashes
if (File.Exists(Application.persistentDataPath + "/kobolds.shiny"))
{
GameMaster.i.spellList.spellList.Clear();
GameMaster.i.LoadSave();
e_ControlGuideFlags.Invoke();
GameMaster.i.spellList.PopulateSpellDict();
StartCoroutine(LoadGameAndPlacePlayer(GameMaster.i.playerStatsSO.sceneAtSaveLocation));
}
else
source.Play();```
it does the `else`
plays the sound, then crashes
oh ok thank you
ah I'm dumb, I think see the problem... testing it out now
I have an Application.Quit() line that is being run unintentionally.... couldnt catch this in the editor because that method does nothing in editor play
yup, that fixed it.... woops
What do i want to accomplish?
I want to receive a HTTP POST request in unity, this will activate a GET request to the backend and return a list of objects
More information
So i have made a http listener in unity, this component is linked to an object.
When i receive a request, it looks like I am not able to call the function where I activate the Get Request
if (context.Request.HttpMethod == "POST") {
var param = new StreamReader (context.Request.InputStream,
context.Request.ContentEncoding).ReadToEnd ();
StartCoroutine(getRequest(param));
}
private IEnumerator getRequest(string name) {
//Here is my request, but it never enters this function
}
I only added the code I think you might need to understand what is going on,
The variable "param" has a string which is used as body in the get request.
Is anyone able to help me here? I don 't understand why I can 't call the startcoroutine function
can you step over the streamreader in the debugger?
the value of the param is correct so I don 't think there is anything wrong with the streamreader, what would u think?
then you should be able to step into getRequest
also be sure to use using on the streamreader
the networking using?
Found it in the meanwhile, turns out api compatibility was still on .NET 2.0 (project was from 3years ago), after putting it on 4.x compatible and reimporting the dll it worked
Debug.Log(param);
StartCoroutine(getRequest(param));
Debug.Log("after");
it logs param, never reaches "after"
and never reaches first line in getrequest()
- cannot tell anything from that little bit of a code
- is this really a question for advanced code channel?
why not use UnityWebRequest for it? you haven't provided enough code to help anyone else to understand whats wrong with your code.
Guessing from what I see, normally a StartCoroutine will not stop the code execution (even when an exception is thrown within the coroutine), but it does run the code instantly until the first yield.
Is there any code within the coroutine which freezes the main thread?
Is your editor responsive after calling StartCoroutine?
if I wanna upload and download a unity scene at runtime
do I have to use AssetBundles?
not necessarily i think, but just use addressables. btw addressables supersede asset bundles
Not really, Addressables uses assetbundles, it's not a replacement
never said it's a replacement. it uses asset bundles but has much more features
Supersede implies it's the replaces, I.e. Takes the place of something
i know. and i'd always take addressables over asset bundles. only because it builds upon them doesn't mean it's not effectively a replacement
but i get what you're saying
I definitely wouldn't, you can't control when things get loaded and unloaded very well due to the design (e.g. being able to call load everywhere without regard for actually loading the bundle)
ok so
what I actually want to do is
take the current scene in the editor
and convert it to an assetbundle or something
and upload it to a server
and then be able to load that asset back in play mode at runtime
so I need to like
click a button and have it trigger a function that gets the current active scene and converts it to an asset that can be shared
please ping me cause I'll forget to check here 💀
for that i would just serialize needed data and upload rather than converting the whole scene
something's glitchy then
oh i see you figured it out
ye, sry for having your time wasted
I have asked this question before but no answer.
Suppose a package used in your project has some utility scripts/classes (Linq, Singleton, JobQueue, TaskUtility, etc.). This package uses that utility classes. Do you prefer to use these utility classes in the entire project or not.
Think if you decide to delete that package (Suppose a package which can replace with another package, video ads, IAP, etc.). How do you handle the dependencies?
the unity ecosystem is old
create a unity package for utilities you author and use, and leave other packages / source code that you control but did not author alone
So you agree that we should not use utility classes used in that external packages in other situations?
yes
do not use utility classes declared in other packages
copy them into your own namespace if they're valuable to you
no trouble at all 🙂
maybe look at modding assets that can help you see the whole picture here
addressables are complicated. but so is the problem.
I agree, thanks
when you use an http server in unity, it's running on a different thread. even if your code is in a monobehaviour, it isn't running inside one. so start coroutine doesn't work. you have to schedule the work for start coroutine inside the main thread. you can do this with UniTask easily.
@fathom flare you can use Kestrel, the cross platform http server from aspnetcore, inside unity. then, you will do something of the form
var builder = WebApplication.CreateBuilder(null);
var app = builder.Build();
app.MapPost("/your-url", async () => {
await UniTask.SwitchToMainThread();
// you can now run code on the main thread.
});
app.RunAsync().Forget();
unitask makes it easy to interoperate with unity's runtime model
kestrel is the best, fully featured, clearly documented web server
why are you converting it?
Suppose I would like to create some packages about different IAP system or ads, etc.
I have decided to create one package for each IAP module and one Core module (generic interfaces, utilities, services and factories)
My questions
1- Factory classes in Core module need to create some instances of those modules but they do not exist in the core module. Should I use something like preprocessors?
2- How do you group these classes by namespaces? Is it OK to exist similar namespaces in different packages? For example in Admob and Adcolony packages, both they have "CompanyName.Advertisement.Platforms" namespace
CompanyName.Advertisement.Platforms (AdColony, Admob, ... classes)
CompanyName.Advertisement.Core
CompanyName.Advertisement.Core.Factories
CompanyName.Advertisement.Core.Services
//
or do you like to group them differently? namespace for each module separately
CompanyName.Advertisement.Core
CompanyName.Advertisement.Admob
CompanyName.Advertisement.AdColony
public class AdFactory{
public Advertisement Create(AdType type){
}
}
Inside Create method, I create an instance of that ad module.
If The factory class is inside Core package that I think it should be but in core package, there is no ad modules
In Unity3d, I can add preprocessors like below
#if Admob
return new Admob();
#endif
public class AdFactory{
public Advertisement Create(AdType type){
switch type{
case:
//...
}
}
}
So, I won't have any compile time errors. I add desire modules and then define the corresponding preprocessors. Any better approach?
I would like to add/remove modules without any problem, having flexibility
can i symbolic link files from an ignored (IgnoredFolderWithTilde~) folder into somewhere else in assets?
or will unity vomit on windows?
if symbolic links are enalbed with git?
Already fixed that problem. I thought I had to use float instead of Vector3, didn't know vector3 was supported by jobs so i converted everything back to vector3 and vector2
great 🙂
I need to upload all the materials used for the map obviously......
I need to upload A WHOLE map
are you familiar with header bidding?
something like a unity package that contains all the assets in a scene
is this a game you're authoring?
do you fully control the source of the game
